By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,452 Members | 1,571 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,452 IT Pros & Developers. It's quick & easy.

Property with arguments

P: n/a
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
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Kimmo,

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

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Kimmo Laine" <reply.to@newsgroup> wrote in message
news:Ok**************@TK2MSFTNGP09.phx.gbl...
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

Nov 15 '05 #2

P: n/a
Unfortunately, no. C# does not support parameterized properties except for
the indexer, which is the equivalent of a VB Default Property.

"Kimmo Laine" <reply.to@newsgroup> wrote in message
news:Ok**************@TK2MSFTNGP09.phx.gbl...
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

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.