When is a property not a property?
Index
‹
.NET Development
‹
Common Language Runtime
Author
Message
silverfrost
Posted: Common Language Runtime, When is a property not a property?
Top
I am wrapping the ADO classes using reflection and producing a C# binding... ADODB.Errors has this property (from the Interop ildasm):
.property class ADODB.Error Item(object)
{
.custom instance void [mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) = ( 01 00 00 00 00 00 00 00 )
.get instance class ADODB.Error ADODB.Errors::get_Item(object)
} // end of property Errors::Item
However, if I use this:
ADODB.Errors FErrors;
FErrors.Item[ ObjectArg2 ];
I get:
ADODB_Errors.cs(111,33): error CS0117: 'ADODB.Errors' does not contain a definition for 'Item'
So....
a) Why
b) I presumably have to use get_Item ... how can I tell I have to do this
.NET Development35
Douglas Stockwell
Posted: Common Language Runtime, When is a property not a property?
Top
When it's an
Indexer.
Note the
DefaultMemberAttribute
on the class.
Try FErrors[ ObjectArg2 ];
silverfrost
Posted: Common Language Runtime, When is a property not a property?
Top
Thank you, that sorted it.
Index
‹
.NET Development
‹
Common Language Runtime