Indexed Property Forces Client to Use get_ /get_ Syntax 
Author Message
 Indexed Property Forces Client to Use get_ /get_ Syntax

I've implemented some properties in a .NET class written in MC++.  When I
try to use this class in a C# client the scalar properties have the
'property' syntax that I would expect, but the indexed properties requires
the use of the get_/set_ syntax.  Is there a reason for this?

Here are the signatures of the property methods.

//MC++
__property Int32 get_Freq(Int32 index);
__property void set_Freq(Int32 index, Int32 val);

Is there something wrong with this?

Thanks,

Tim Rogers



Sun, 17 Apr 2005 01:54:42 GMT  
 Indexed Property Forces Client to Use get_ /get_ Syntax
Tim,

Quote:
> I've implemented some properties in a .NET class written in MC++.  When I
> try to use this class in a C# client the scalar properties have the
> 'property' syntax that I would expect, but the indexed properties requires
> the use of the get_/set_ syntax.  Is there a reason for this?

Yes, C# doesn't support indexed properties directly. The only indexed
property C# supports on an object is the one marked as the "default"
property [1], which is, in fact, what marks it as the class indexer.

[1] http://www.winterdom.com/mcppfaq/archives/000125.html
--
Tomas Restrepo



Sun, 17 Apr 2005 08:13:59 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Accesing put_ property without get_ property in VB

2. Getting index of selected/clicked subitem in a ListView

3. Getting an item by it's name (instead of it's index#)

4. Getting Access ODBC driver to use index

5. getting index of selected list control

6. CListCtrl : getting the column index ?

7. getting an iterator at vector index

8. Getting an Index from an Iterator

9. Syntax Coloring - Getting it right.

10. PRB: Getting E_NOINTERFACE when using DCOM, everything is OK when used locally

11. gets( ) gets crash

12. Getting started to write a email client

 

 
Powered by phpBB® Forum Software