473,322 Members | 1,307 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,322 software developers and data experts.

property overloading

I'm converting a project from MC++ to C++/CLI but can't figure out how to
convert this overloded property:

__property void set_Item(String *key, Object *value);
__property Object *get_Item(String *key);
__property void set_Item(String *key, int index, Object *value);
__property Object *get_Item(String *key, int index);
Nov 17 '05 #1
10 1139
Hello Tomas,
property Object^ default[String^] {


be aware that this is C# 2.0 beta code!

--
Greetings
Jochen
Nov 17 '05 #2
> be aware that this is C# 2.0 beta code!

upps: VC2005 beta...
--
Greetings
Jochen
Nov 17 '05 #3
Hello Tomas,
be aware that ...


ups... ignore it... it´s friday.... sorry...

--
Greetings
Jochen
Nov 17 '05 #4
Terje,
I'm converting a project from MC++ to C++/CLI but can't figure out how to
convert this overloded property:

__property void set_Item(String *key, Object *value);
__property Object *get_Item(String *key);
__property void set_Item(String *key, int index, Object *value);
__property Object *get_Item(String *key, int index);


Try this:

property Object^ Item[String^] {
Object^ get(String^ key) { return nullptr; }
void set(String^ key, Object^ value) { }
}

property Object^ Item[String^,int] {
Object^ get(String^ key, int index) { return nullptr; }
void set(String^ key, int index, Object^ value) { }
}

If you wanted to turn it into a default indexed property, then just make it
this way:
property Object^ default[String^] {
Object^ get(String^ key) { return nullptr; }
void set(String^ key, Object^ value) { }
}

property Object^ default[String^,int] {
Object^ get(String^ key, int index) { return nullptr; }
void set(String^ key, int index, Object^ value) { }
}

--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #5
Hello Tomas,
property Object^ default[String^] {


be aware that this is C# 2.0 beta code!

--
Greetings
Jochen
Nov 17 '05 #6
> be aware that this is C# 2.0 beta code!

upps: VC2005 beta...
--
Greetings
Jochen
Nov 17 '05 #7
Hello Tomas,
be aware that ...


ups... ignore it... it´s friday.... sorry...

--
Greetings
Jochen
Nov 17 '05 #8
On Fri, 27 Aug 2004 04:19:38 -0700, Jochen Kalmbach wrote:
Hello Tomas,
be aware that ...


ups... ignore it... it´s friday.... sorry...


Just curious, what was it?

--
Daniel
Nov 17 '05 #9
On Fri, 27 Aug 2004 04:19:38 -0700, Jochen Kalmbach wrote:
Hello Tomas,
be aware that ...


ups... ignore it... it´s friday.... sorry...


Just curious, what was it?

--
Daniel
Nov 17 '05 #10
Hi Daniel,
ups... ignore it... it´s friday.... sorry...


Just curious, what was it?


The original question was about the new syntax...

--
Greetings
Jochen
Nov 17 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Terje Slettebø | last post by:
To round off my trilogy of "why"'s about PHP... :) If this subject have been discussed before, I'd appreciate a pointer to it. I again haven't found it in a search of the PHP groups. The PHP...
2
by: cody | last post by:
Does the clr allow more than one set and one get method for a property? Is it possible to use overloading for example set_Color(int c), set_Color(Color c)? from msdn: ...
14
by: Codemonkey | last post by:
Just a silly question, but why can't you overload a writeonly property with a readonly one? Surely the compiler can tell the difference of which one to call at compile time, depending on if it is...
2
by: cody | last post by:
Does the clr allow more than one set and one get method for a property? Is it possible to use overloading for example set_Color(int c), set_Color(Color c)? from msdn: ...
2
by: garyusenet | last post by:
I could do with something similiar, can you tell me if you think this would work for me, and if there's any advantage in working with controls this way than how I currently am. At the moment...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.