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.
"Jon Skeet [C# MVP]" <skeet@pobox.com> schrieb im Newsbeitrag
news:MPG.1b799d972559b19f98b082@msnews.microsoft.com...
[quoted text, click to view] > Eric <fish11@earthling.net> wrote:
> > 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?
>
> --
> Jon Skeet - <skeet@pobox.com>
>
http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too