I made a class using generics and I have a method like this
public bool Insert(T Item)
{
if (T == null)
{
throw new System.Exception();
}
// other code goes here
}
So if my T is a struct, will the compiler still generate the code to compare T to null or not

Generics, comparing (T == null)
John Shuttleworth
FernanPa
Dundealing
emkay
Yes, but it will always evaluate to false for value types.
HTH,
Kent
Larry Beck
sorry for the typo...
I know it does generate (Item == null) in PE format, but will it still be there after the compiler produces native code It seems that the compiler could do some optimizations by eliminating the comparison for structs.