fjgandrade / sharpkit

Automatically exported from code.google.com/p/sharpkit
0 stars 0 forks source link

Extension methods as instance methods with generic parameters #124

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
when using this, it will work:
public static void add<T>(this JsArray<T> self, object value) {
  self.As<JsArray>().push(value);
}

but when using this, it will not work:
public static void add<T>(this JsArray<T> self, T value) {
  self.As<JsArray>().push(value);
}
output: myArray.add(item); //MyExtension.add(myArray,  item ) would be correct.

Even this will not work:
[JsMethod(Name = "push", ExtensionImplementedInInstance = true, NativeOverloads 
= true)]
public static void add<T>(this JsArray<T> self, T value) {}
output: myExtension.add$1$$T$Array$$Object(LARNE.TDataColumn, myArray, item); 
//totally wrong, it should be myArray.push( item )

The Extension-Class itself is in clr-mode.

Original issue reported on code.google.com by DanelK...@gmail.com on 13 May 2012 at 6:35