Coffeehouse Post

Single Post Permalink

View Thread: C# Extension Properties?
  • User profile image

    ExceptionDuck said:
    Jonwib said:

    I did something like this to copy function


    public static class extends{
      public static Dictionary> v = new Dictionary>();
      public static object data(this object o, object key,object val = null)
       if (!v.ContainsKey(o))
       v[o] = new Dictionary();
        return v[o][key];
       v[o][key] = val;
       return val;

    It won't distinguish between equal simple types, but for complex it works well.


    With this you can call any object's data method


    F = new Form();"language","EN");


    and inside F you could call

 "language") and it would return "EN"

    Wow, thread Necromancy!


    Also, use F# you can extend everything Smiley