473,408 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Property with arguments

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
2 5479
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: riccoi | last post by:
Hi. I had created a Windows Application ant put there the code down there. I am trying to get information about the processes that are currently running in my machine. The problem is: ...
3
by: Noozer | last post by:
I have several tags on a webpage of the same class. If the user clicks a specific checkbox I'd like to be able to alter the display property of the class, affecting all objects of that class. ...
3
by: mikeorb | last post by:
Is there a way to determine the object that a property is in? For example: function MyClass() { ... } MyClass.prototype.myFunc = function() { ... } var obj = new MyClass(); var sameobj =...
15
by: Prachi Dimble | last post by:
Hi, In vb.Net one can pass arguments to properties. How does one achieve it in c#? Given below is the vb.net code for passing arguments to property getters and setters.. Thanks, Prachi ...
7
by: TJ | last post by:
In C# how do you achieve pass-by-reference property declarations in the Type Library? I am writing a COM Class Library that must mimick an existing library for which the only information is the...
5
by: fred | last post by:
With a Class is there any difference between a readonly property and function besides having to use Get/End Get. Are there any performance/resource advantages for either. Thanks Fred
2
by: =?Utf-8?B?Z2FkeWE=?= | last post by:
I use one of 2 arrays dependent on the country. Rather than say: if exchangeID = 1 then dim myPlaceBets() as As UK.exchange.PlaceBets many statements myPlaceBetsReq.bets = myPlaceBets else...
1
by: Allan Ebdrup | last post by:
I have a asp.net v2 website that runs fine on our development server. I have published the website to a stage server and it runs fine, but when I publish it to production I get the following error:...
3
by: james_027 | last post by:
hi, i am very new to python, not knowing much about good design. I have an object here for example a Customer object, where I need to retrieve a info which has a number of lines of code to get...
1
by: mk | last post by:
It seems like getter is defined in such way that it passes only 'self': class FunDict(dict): def __init__(self): self.fundict = dict() def fget(self, fun): return fundict
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.