Thursday, 7 July 2016

What is the purpose of as operator in C#?

as operator casts without raising an exception if the cast fails.
Object obj = new StringReader("Hello");
StringReader r = obj as StringReader;

No comments:

Post a Comment