Created
June 17, 2011 21:53
-
-
Save ah01/1032439 to your computer and use it in GitHub Desktop.
Extension Methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
// Co provede následující program? | |
// | |
// a) Vyvolá NullReferenceException | |
// b) Vypíše "true" | |
// c) Vypíše "false" | |
// d) To netuším, jsem Javista a tam Extension Metody nejsou :( | |
public static class TestProgram | |
{ | |
public static void Main() | |
{ | |
String s = null; | |
Console.WriteLine( s.IsNull() ? "true" : "false" ); | |
} | |
static bool IsNull(this object @this) | |
{ | |
return @this == null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment