Property with arguments

  • Thread starter Thread starter Kimmo Laine
  • Start date Start date
K

Kimmo Laine

Hello,

is there a way to do this VB6 code in C#:

Enum MyEnumA
A1
A2
End Enum

Enum MyEnumB
B1
B2
End Enum

Property Let TheValue(par1 As MyEnumA, par2 As MyEnumB)
' . . .
End Property

Property Get TheValue(par1 As MyEnumA) As MyEnumB
' . . .
End Property

' . . .
dim e As MyEnumB
TheValue(A1) = B1
e = TheValue(A2)



thx

Kimmo Laine
 
Hi Kimmo,

No, you cannot do that, in C# the properties have no parameters. You should
use a method for this.

Cheers,
 
Unfortunately, no. C# does not support parameterized properties except for
the indexer, which is the equivalent of a VB Default Property.
 
Back
Top