Hello !
I'm trying to convert this code from C# to VB.net using converters , but the converted code has errors :
Code:
dynamic DynamicCast(object entity, Type to)
{
var openCast = this.GetType().GetMethod("Cast", BindingFlags.Static | BindingFlags.NonPublic);
var closeCast = openCast.MakeGenericMethod(to);
return closeCast.Invoke(entity, new[] { entity });
}
Code:
Private Function DynamicCast(entity As Object, [to] As Type) As dynamic
Dim openCast = Me.[GetType]().GetMethod("Cast", BindingFlags.[Static] Or BindingFlags.NonPublic)
Dim closeCast = openCast.MakeGenericMethod([to])
Return closeCast.Invoke(entity, New () {entity})
End Function
First of all the expression "... as dynamic" is unkown
Second : in the ...return.. line the expression "New () {entity}" has eeror : Type expected.
What should I change to correct these errors ?
Thank you !