C # does not allow you to create member aliases, only from types. Thus, the only way to do something like this in C # would be to create a new property accessible from this area:
class Program { static string MyMember { get { return MyClass.MyMember; } set { MyClass.MyMember = value; } } static void Main(string[] args) { MyMember = "Some value."; } }
This is actually not an alias, but it executes the syntax you are looking for.
Of course, if you only access / change a member on MyClass and do not assign it, this can be simplified a bit:
class Program { static List<string> MyList = MyClass.MyList; static void Main(string[] args) { MyList.Add("Some value."); } }
source share