ExceptionDuck said:
Jonwib said:
*snip*

I did something like this to copy Jquery.data 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();
   if(val!=null)
    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();

F.data("language","EN");

 

and inside F you could call

 

this.data("language") and it would return "EN"

Wow, thread Necromancy!

 

Also, use F# you can extend everything Smiley