Blog ( Of Ryan Olshan)

Recent Posts

News

About Ryan Olshan

LinkedIn Profile

Follow Ryan via twitter

Join StrongTypes - Free Generics Help By Email
Join StrongTypes

Community Credit Winner

View my MVP profile

The posts on this weblog are provided "as is" with no warranties and confer no rights. The opinions expressed herin are my own personal opinions and do not represent my employer's view in any way.

Subscribe to Rolog via My AOL
Subscribe to Rolog via Bloglines


Subscribe to Rolog via Feedburner

Furl Rolog




Subscribe to Rolog via Newsburst


Subscribe to Rolog via Pluck

Add Rolog to Technorati Favorites




Thycotic Secret Server

Receive Email Updates


.NET Websites

  • => StrongTypes.com <=
  • Community Credit
  • DotNetCharity.com
  • DotNetSlackers
  • EasyListBox
  • LearnAsp.com
  • SystemNetMail.com
  • SystemWebMail.com

Blogroll

  • Alex Campbell
  • Carlos Magalhaes
  • Charles Carroll
  • Chris Taylor
  • Darren Neimke
  • David Betz
  • Eric Smith
  • Rob Caron
  • Rob Howard
  • Sam Gentile
  • Scott Guthrie
  • Scott Mitchell
  • Tess
  • Wesner Moise
  • Jason Alexander
  • Bill Ryan
  • Steve Smith
  • Sahil Malik
  • David Silverlight

Other Websites

  • 911 Pigeon Alert
  • Pacific Wildlife Project

Strong Coder Bloggers

  • Dean Fiala
  • Doug Nelson
  • Kevin Jones

Yahoo! Groups

  • => StrongTypes <=
  • AspNet2
  • AspNet20GridView
  • PayPalDevDotNet
  • RubyOnRails
  • VSTS

Tuesday, December 06, 2005 - Posts

Limitations of Generics Polymorphism

Here is an interesting blog entry on the limitations of Generics polymorphism: http://www.geekswithblogs.net/michelotti/archive/2005/12/05/62273.aspx .

R

Share this post: | bookmark it! | digg it! | reddit! | kick it! | live it!
Posted: Dec 06 2005, 08:03 PM by Ryan Olshan | with no comments
Filed under:
.NET Generic Books
Right now there are only two books out there that cover Generics, and out of the two only one is dedicated to Generics. I ordered Professional .NET 2.0 Generics last week and it should be arriving in the mail any day now. I am in the process of reading Juval Lowy's book. As I finish the books, I will provide feedback.

For an updated listing of .NET Generic books, please visit the StrongTypes.com books section .




Professional .NET 2.0 Generics (Programmer to Programmer)


by Tod Golding

The power and elegance of generic types have long been acknowledged. Generics allow developers to parameterize data types much like you would parameterize a method. This brings a new dimension of reusability to your types without compromising expressiveness, type-safety, or efficiency.



Programming .NET Components, 2nd Edition (Paperback)


by Juval Löwy

Brilliantly compiled by author Juval Lowy, Programming .NET Components, Second Edition is the consummate introduction to the Microsoft .NET Framework--the technology of choice for building components on Windows platforms.

R

Share this post: | bookmark it! | digg it! | reddit! | kick it! | live it!
Posted: Dec 06 2005, 05:12 PM by Ryan Olshan | with no comments
Filed under:
What's wrong with Eval()?
The .NET Framwork 2.0 introduces Eval() . Eval() is a shortcut for Container.DataItem() . Since Eval() uses Reflection, it causes overhead. From a optimization standpoint, it is better to use Container.DataItem() .

VB.NET

Container.DataItem()

C#
DataReader: ((System.Data.Common.DbDataRecord)Container.DataItem)[]
DataSet: ((System.Data.DataRowView)Container.DataItem)[]

R
Share this post: | bookmark it! | digg it! | reddit! | kick it! | live it!
Posted: Dec 06 2005, 03:45 PM by Ryan Olshan | with 1 comment(s)
Filed under: , , ,
Generic Collections Article
I just published an article on Generic Collections. It demonstrates a basic use of a Generic collection as well as compares non-Generic and Generic collections.

Generic Collections Article

R
Share this post: | bookmark it! | digg it! | reddit! | kick it! | live it!
Posted: Dec 06 2005, 02:00 PM by Ryan Olshan | with no comments
Filed under:
C# Version 3.0 Specifications
Have you ever wondered what the next version of C# (3.0) has to offer? Microsoft has published the specifications and they can be downloaded at http://tinyurl.com/baoh8 .

R

Share this post: | bookmark it! | digg it! | reddit! | kick it! | live it!
Posted: Dec 06 2005, 11:40 AM by Ryan Olshan | with 2 comment(s)
Filed under:
Multiple DataKeys Null Conditional
Lets say you have multiple DataKeys assigned to the DataKeyNames property of the GridView control where only one DataKey will have a value and the rest will be null. Based on the non-null value, you want to trigger a conditional. I've discovered an easy to accomplish this is using Reflection and a GridView event. In this example, the value of my DataKeys are all of type integer.

VB.NET
Private Sub GridView_Created( ByVal sender As Object , ByVal e As GridViewRowEventArgs )
   
If e.Row.RowType = DataControlRowType.DataRow Then
       
Dim nKeyVal As Integer

       
If g ridView.DataKeys(e.Row.RowIndex).Values( "K eyName1" ).GetType() == Type .GetType( "System.Int32 " ) Then
            nKeyVal = 
g ridView .DataKeys(e.Row.RowIndex).Values ( "K eyName1" )

            ' Do something

        End If

        If g ridView.DataKeys(e.Row.RowIndex).Values ( "K eyName2" ).GetType() == Type .GetType( "System.Int32 " ) Then
            nKeyVal = 
g ridView .DataKeys(e.Row.RowIndex).Values ( "K eyName2" )

           
' Do something
        End If

        If gridView.DataKeys(e.Row.RowIndex).Values ( "K eyName3" ).GetType() == Type .GetType( "System.Int32 " ) Then
            nKeyVal = 
gridView .DataKeys(e.Row.RowIndex).Values( "K eyName3" )

            ' Do something
       
End If
    End If
End Sub

C#
private void GridView_Created( object sender, GridViewRowEventArgs e)
{
   
if (e.Row.RowType == DataControlRowType.DataRow)
    {
       
int nKeyVal;

       
if ( g ridView.DataKeys[e.Row.RowIndex].Values[ "K eyName1" ].GetType() == Type .GetType( "System.Int32 " ))
        {
            nKeyVal = (
int ) g ridView .DataKeys[e.Row.RowIndex].Values[ "K eyName1" ];

           
// Do something
        }

        if ( g ridView.DataKeys[e.Row.RowIndex].Values[ "K eyName2" ].GetType() == Type .GetType( "System.Int32 " ))
        {
            nKeyVal = (
int ) g ridView .DataKeys[e.Row.RowIndex].Values[ "K eyName2" ];

           
// Do something
        }

        if (gridView.DataKeys[e.Row.RowIndex].Values[ "K eyName3" ].GetType() == Type .GetType( "System.Int32 " ))
        {
            nKeyVal = (
int ) gridView .DataKeys[e.Row.RowIndex].Values[ "K eyName3" ];

            // Do something
        }

    }
}


Note: gridView is the ID of the GridView control.

R
Share this post: | bookmark it! | digg it! | reddit! | kick it! | live it!
Posted: Dec 06 2005, 09:53 AM by Ryan Olshan | with no comments
Filed under: ,
C# Generics List Collection Article

I just published a new article on LearnAsp.com that demonstrates using a Generics List Collection in C# to store the retrieval of all folders, subfolder, and folders within subfolders.

Folders File System Article

R

Share this post: | bookmark it! | digg it! | reddit! | kick it! | live it!
Posted: Dec 06 2005, 12:35 AM by Ryan Olshan | with no comments
Filed under:
More Posts