Yes, this is know.
My question was, if there is an easy way to 'go down the class tree' to find
the field.
Is there no recursive function for doing this?
> > Thanks for answering.
> >
[quoted text clipped - 5 lines]
> the CardIndex class, but you're asking for it as if it were part of
> insuranceType.
> Yes, this is know.
It makes your first question somewhat odd then - it has nothing to do
with the values of fields.
> My question was, if there is an easy way to 'go down the class tree'
> to find the field.
What, you want to use the type of the field to look for other
"subfields"?
(That wasn't the question you asked, btw. It would help if you could be
a bit more specific to start with.)
> Is there no recursive function for doing this?
Not built-in, no. It wouldn't be too hard to write though. Bear in mind
that the declared type of a field may be different from the actual
type. For instance, a field of type "object" might have a value which
is a reference to an object of type "CardIndex" - which type would you
want to search in that situation?

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Eric - 03 Aug 2004 15:04 GMT
Sorry, I'm not perfect in English.
But what I try to do is the following:
- I have a flat text file with a header and rows of data
- I read the header and get this way the name of the desired (destinations)
fields.
- I create a new empty object to fill it up with the first data record from
the flat file
(The class definition is created from a XSD file)
- Now I try to match the field name with the class structure
- If field is found, I set the value with the value from the flat file
Conditions:
* Field names are unique
* Only Basetypes are served
I like to do it this way, because the XSD can change often (Names and
Structure) and also the columns of the flat file.
> > Yes, this is know.
>
[quoted text clipped - 17 lines]
> is a reference to an object of type "CardIndex" - which type would you
> want to search in that situation?
Jon Skeet [C# MVP] - 03 Aug 2004 15:22 GMT
> Sorry, I'm not perfect in English.
>
[quoted text clipped - 14 lines]
> I like to do it this way, because the XSD can change often (Names and
> Structure) and also the columns of the flat file.
And you don't just want the field names of the type itself, but of
contained types.
Well, it's certainly doable fairly easily with recursion, but there's
nothing to do it automatically for you in the framework.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too