Indexers
-
I'm writting an app in MC++. One of its class is a collection and I don't know what to do to have indexers in C#. When I disassemble C# code the indexer function is as follow:
get_Item : class System.String(int32)
I tried to add function like this but I didn't work. :(( Can somebody tell if it's possible.
-
I'm writting an app in MC++. One of its class is a collection and I don't know what to do to have indexers in C#. When I disassemble C# code the indexer function is as follow:
get_Item : class System.String(int32)
I tried to add function like this but I didn't work. :(( Can somebody tell if it's possible.
Create a property called Item which takes a common parameter in both its set/get functions. ie
__property System::String* get_Item(int index)
{
....
}__property void set_Item(int index, System::String* value)
{
....
}I don't see anything that lets you create a C# indexer were the class instance can be treated as an array; I assume if you use the Item property name it allows C# to use it as if it were one. HTH, James
-
Create a property called Item which takes a common parameter in both its set/get functions. ie
__property System::String* get_Item(int index)
{
....
}__property void set_Item(int index, System::String* value)
{
....
}I don't see anything that lets you create a C# indexer were the class instance can be treated as an array; I assume if you use the Item property name it allows C# to use it as if it were one. HTH, James
I don't work. C++ function disassembly is
.method public specialname instance string
get_Item(int32 index) cil managedand C# is
.method public hidebysig specialname instance string
get_Item(int32 index) cil managedMayby it's possible to write this function in CLR?
-
I don't work. C++ function disassembly is
.method public specialname instance string
get_Item(int32 index) cil managedand C# is
.method public hidebysig specialname instance string
get_Item(int32 index) cil managedMayby it's possible to write this function in CLR?
It appears Indexers created in MC++ only work in MC++ AND you can't create an indexer that operates on a class instance. I'll look into it more after the hockey game :) James
-
It appears Indexers created in MC++ only work in MC++ AND you can't create an indexer that operates on a class instance. I'll look into it more after the hockey game :) James
I'll appreciate it. :) Thanks