Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Property with parameter

I got something strange into VB.NET, never notice before...

I have a class in VB.NET having a property with parameter and I want to use that property in other C# Class by making object of VB.NET class but class object not showing that property, could any one tell me whether I can access that property into C# or not.

  • If yes, how?
  • If no, what does CLR mean?

Here is my code...

Public Property AsString(ByVal name As String) As String
    Get
            //Some code
    End Get
    Set(ByVal value As String)
            //Some code
    End Set
End Property

Note: I can not change VB.NET code as it is compiled DLL.

Thanks in Advance

like image 525
ANKIT Avatar asked Dec 21 '11 22:12

ANKIT


1 Answers

Parameterised Properties are converted to get_ and set_ methods.

string name = "Foo";
string value = "Bar";
MyObject.set_AsString(name, value);
string fooValue = MyObject.get_AsString(name);
like image 56
Hand-E-Food Avatar answered Oct 12 '22 12:10

Hand-E-Food