In my previous article, I have created an extension method call StrToInt for String class. Now, the question is what if a string object instance is null value and it's calling the extension method? Will the program crash? The answer is NO.
Try this out:
string s = null;
int i = s.StrToInt();
No comments:
Post a Comment