Created
November 17, 2014 15:23
-
-
Save ufcpp/711e827e3ec028ff7cfd to your computer and use it in GitHub Desktop.
private nameof
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; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
// This can be compiled. | |
// Looks like the compiler translates this "nameof" into the nameof expression on build time. | |
// However, the language service in Visual Studio interprets it as the private X.nameof method. | |
var name = nameof(Main); | |
Console.WriteLine(name); | |
} | |
private static string nameof(Action x) => "private method"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment