Last active
October 20, 2015 14:06
-
-
Save ufcpp/e73da07c8b9773e0615f to your computer and use it in GitHub Desktop.
nightmare code by "using static"
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; | |
using My.X; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
var name = nameof(Main); // invocation of the My.X.nameof method | |
Console.WriteLine(name); | |
} | |
} | |
namespace My | |
{ | |
public static class X | |
{ | |
public static string nameof(Action x) => ""; | |
} | |
} |
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; | |
using System.Linq; // using static class, not namespace (warning only, no error) | |
public class Program | |
{ | |
public static void Main() | |
{ | |
var name = nameof(Main); // invocation of the nameof method in my System.Linq | |
Console.WriteLine(name); | |
} | |
} | |
namespace System | |
{ | |
public static class Linq | |
{ | |
public static string nameof(Action x) => ""; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment