|
by jokiz via jokiz : C# on 6/11/2005 6:04:00 AM
Boxing and unboxing in C# has a performance cost and the use of the IS and AS operator in casting objects is trivial for me. I thought before that:[code language="C#"]if (boxed is Person){ Person unboxed = boxed as Person; //do something}[/code]is better than [code language="C#"]Person unboxed = boxed as Person;if (unboxed != null){ //do something} [/code]for the reason (which I believed before, without any basis) that the first one doe
... [ read more ]
|