Skip to content

Instantly share code, notes, and snippets.

@ufcpp
Created November 17, 2014 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ufcpp/711e827e3ec028ff7cfd to your computer and use it in GitHub Desktop.
Save ufcpp/711e827e3ec028ff7cfd to your computer and use it in GitHub Desktop.
private nameof
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