> Hi,
> Yes there are performance benefits of using keywords "as" and "is".Because
> keyword "is" does not use relection it is much faster.You will find in
> detail
faster than GetType, yes. Faster than a cast, not unless the cast invokes a
user-defined conversion, in which is/as will fail.
> about performance benefits of keyword "as" and "is" in the following URL:
>
> http://gabewishnie.blogspot.com/2005/10/is-and-as-lesser-known-c-keywords.html
You may want to rely on expert sources. That blog incorrectly asserts that
"is" and "as" use the same MSIL instruction, whereas there are two separate
instructions "isinst" and "castclass".
In addition, while "is" works perfectly well in the examples shown in that
blog, it is not equivalent. For example:
object s = "ABC";
s.GetType() == typeof(object); // false
s is object; // true
> Thanks and Regards,
> manish bafna
[quoted text clipped - 6 lines]
>>
>> Thanks for your clarifications!