Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ufcpp
Last active October 20, 2015 14:06
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/e73da07c8b9773e0615f to your computer and use it in GitHub Desktop.
Save ufcpp/e73da07c8b9773e0615f to your computer and use it in GitHub Desktop.
nightmare code by "using static"
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) => "";
}
}
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