Re: What type of object for this?
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 2 Apr 2006 23:17:42 -0400
Brett,
I would use a class, and then have static fields as you do.
Additionally, I would have a type constructor which would initialize a
read-only dictionary which you expose, which would use reflection and cycle
through the fields exposed on the type. It would populate with name/values,
if you need that.
Either that, or I would pass the type around.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Brett Romero" <account@xxxxxxxxx> wrote in message
news:1144033861.096043.234420@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I need an object similar to a struct that allows me to write something
like this:
public struct TheFields
{
public static string Hand = "Hand";
public static string PersonID = "PersonID";
}
and reference the fields by name such as TheFields.Hand and get the
value "Hand". The above does all of this. However, I need the
ability to loop blindly through these fields (strings) and get their
values. This construct also needs to be passed in as a parameter to
an object, which will then loop through and get the string values.
I don't think an arraylist will work because I can say myarray.Hand.
I'd have to know what the index of hand is and even then, intellisense
will not do myarray[2].Hand. I need the intellisense to popout all of
the fields within this construct so I can go to the one I want.
Any ideas?
Thanks,
Brett
.
- Follow-Ups:
- Re: What type of object for this?
- From: Brett Romero
- Re: What type of object for this?
- References:
- What type of object for this?
- From: Brett Romero
- What type of object for this?
- Prev by Date: What type of object for this?
- Next by Date: Re: Data type for marshaling BYTE*
- Previous by thread: What type of object for this?
- Next by thread: Re: What type of object for this?
- Index(es):
Relevant Pages
|