lundi 15 juin 2015

Using C#, how can I access the getter/setter of a VB class's property with parameter?

I'm using a DLL, which I cannot change. The DLL is written using VB.NET. There is a class, which contains properties such as:

Public Property MyProperty(Name As String) As SomeObject
     //getter & setter
End Property

Using VB.NET, I would access these values like this

Dim myVar As String = MyClass.MyProperty("a property name").Value

How would I access this same property using C#? I found an answer for a similar situation here. However, I need to apply the concept to something other than a string.

So far I have tried

String returnValue = MyClass.get_MyProperty("a property name").Value

This causes a build error:

'MyClass.this[string].get': cannot explicitly call operator or accessor





Aucun commentaire:

Enregistrer un commentaire