Tech Off Post

Single Post Permalink

View Thread: Features you like added to, c# or any other .net language.
  • User profile image

    sysrpl said:

    Virtual constructors.

    // public virtual SampleObject(string name)  {  }


    Virtual static methods.

    // public static virtual DoSomething() { }


    Virtual static constructors.

     // public static virtual SampleObject(string name)  {  }


    Enumeration set operations.

    // textBox.Anchors += { AnchorStyles.Right, AnchorStyles.Bottom };


    Implementation through delegation.

    // public class SomeItems : IList<SomeItem> { private List<SomeItem> items; private implements IList<SomeItem> GetList() { return items; }  }


    Static method extensions.

    // public static void DoSomething(this SomeType, string message);


    Property extensions.

    // public string FunnyName { this SomeType; get; set; }


    Static property extensions.

    // public static string FunnyName { this SomeType; get; set; }


    Type aliases.

    // public typedef SomeItemList = List<SomeItem>;


    Expando properties and methods.

    // instance.SomeNewProperty = 12; instance.SomeNewMethod = (string message) => MessageBox.Show(message);


    Class references.

    // public SomeItemClass = class of SomeItem;


    Message based dynamic methods.

    // public message(1) void DoSomething(ref MessageArgs messageArgs) { }


    Type aliasing has been in C# since the beginning.


    using StringList = System.Collections.List<System.String>;


    the only problem with the syntax is that unless a type is specified with a keyword (string/int/etc) you must use the full type name, which gets tedious after a while. I'd prefer it if it respected existing namespace imports to resolve type names.