actually I don’t know whether they should work
I made a library in C# and I’ve been told by people that one of mine methods don’t work in VB.NET as extension
http://valueinjecter.codeplex.com/Thread/View.aspx?ThreadId=227498
this is the method:
public static PropertyDescriptorCollection GetProps(this object o)
{
return GetProps(o.GetType());
}
In general C# extension methods work just fine in VB.Net and vice versa. The one exception is when the
thisparameter is explicitly typed toObject. For legacy reasons VB.Net does not support the use of extension methods on references that are typed toObject.The reason why is has the potential to cause code to silently recompile with different semantics. VB.Net (and C#) took the stance that importing a namespace which contains extension method(s) should not cause a silent rebind of existing code to the extension method. If VB.Net allowed extension methods on
Objectthen it would be possible for late bound calls to silently rebind to the extension method and hence change the code.For example. Consider the following written before your extension method.
If VB.Net allowed the
GetPropsextension method to be defined onObjectthen simply importing your namespace would change the meaning ofGetPropsfrom late bound to an extension method call.