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

indexers and reflection

I'm writing some reflection code which resolves the value of a complex
expression (e.g. MyInfo.Customers[3].Orders["Order305"].Date), against a
specific object.

I'm struggling a bit with indexers.

I'm not entirely sure how I can find the indexer(s?) on an object. although
there is a default name 'Item' it doesn't have to be that, and there seems
to be no 'GetIndexers' method on Type (I know that an indexer is a property,
but which one?).

Anyone help?

Iain
Nov 16 '05 #1
2 2223
Iain,
I'm struggling a bit with indexers.

I'm not entirely sure how I can find the indexer(s?) on an object. although
there is a default name 'Item' it doesn't have to be that, and there seems
to be no 'GetIndexers' method on Type (I know that an indexer is a property,
but which one?).

Anyone help?

Look for the System.Reflection.DefaultMemberAttribute on the type.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #2
Thanks. That was what I needed.

Iain
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:OL**************@tk2msftngp13.phx.gbl...
Iain,
I'm struggling a bit with indexers.

I'm not entirely sure how I can find the indexer(s?) on an object. althoughthere is a default name 'Item' it doesn't have to be that, and there seemsto be no 'GetIndexers' method on Type (I know that an indexer is a property,but which one?).

Anyone help?

Look for the System.Reflection.DefaultMemberAttribute on the type.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 16 '05 #3

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

Similar topics

12
by: Sergey Klementiev | last post by:
Why it's impossible to have a static indexer in C#?
3
by: DKode | last post by:
Ok, Consider the following example: School Class - StudentCollection Property StudentCollection Class : CollectionBase - Add - Item
2
by: Jim | last post by:
How does one determine what indexers are available on a given object? The only way I have found is by looking at the Object Browser. But even then it only gives a simple signature like, this....
1
by: mdub317 | last post by:
I'm totally new to programming and I am wondering; when would be a good time to use an array or an indexer? I want to know what types of applications would make good use of arrays or indexers. ...
5
by: bonk | last post by:
Hello, IL does not have indexers. Infact the c# compiler compiles indexers to Set_Item and Get_Item (or whatever name I choose via the IndexerNameAttribute ). So how does c# (compiler) know...
6
by: Pete Davis | last post by:
I'm writing an XML serializer (similar to the MS XMLSerializer). It uses reflection to get the values from a class/struct. The one area I'm confused on is indexers. I can get the indexer...
5
by: Jeremy McPeak | last post by:
I am writing a collection. I downloaded the Rotor kit and started looking at how the classes in System.Xml are written and am using them as a guide. For my collection, I thought I'd use XmlNodeList...
0
by: liko81 | last post by:
I have an Invoice class that must know, directly or indirectly, how to do anything associated with creating, reading, or otherwise processing an invoice to a customer. It is an uber-DAO object that...
3
by: Benssol | last post by:
Hi all great programmers and great coders Please can anyone explain clearly the following: usage of indexers? is it used widely (in most applications)? is there is another way that do its...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.