Re: Reflection and order of the fields
From: Frank D Lombardo (Frank_at_NoSpam.com)
Date: 03/08/04
- Next message: Krzysztof Kazmierczak: "RE: Use of the ceAppMgr"
- Previous message: Krzysztof Kazmierczak: "RE: Use of the ceAppMgr"
- In reply to: Nicholas Paldino [.NET/C# MVP]: "Re: Reflection and order of the fields"
- Next in thread: Kevin P. Fleming: "Re: Reflection and order of the fields"
- Reply: Kevin P. Fleming: "Re: Reflection and order of the fields"
- Reply: Ignacio Machin \( .NET/ C# MVP \): "Re: Reflection and order of the fields"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 8 Mar 2004 13:22:23 -0500
I guess I didn't tell you all of the requirements. The device at the other
end is an instrument I am trying to control. My code needs to run on both
the full framework and the compact framework. The objects I want to send
are command objects that have different data fields depending on the nature
of the command.
Because of my specific serialization requirements, I was hoping to write my
own generic command serializer that would use reflection to determine the
run-time data fields of the command and send them over the wire. I'm just
not sure if I can rely on the declarative order of the fields being the
order that they are returned from GetFields().
-- Frank D. Lombardo Turning Point Technology, Inc. Frank_AT_TurningPointOnline_DOT_com "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard.caspershouse.com> wrote in message news:%233PBFgTBEHA.892@tk2msftngp13.phx.gbl... > Frank, > > I am curious, if you are sending an object over the wire, then why not > just use serialization (assuming that .NET is on the other side of the > wire). > > The order of the fields is not guaranteed. Some reasonable assumptions > would be to get them in declarative order, and alphabetical, but I am not > sure. If you need a specific order, I would recommend getting the specific > fields and then ordering them yourself. > > Hope this helps. > > > -- > - Nicholas Paldino [.NET/C# MVP] > - mvp@spam.guard.caspershouse.com > > "Frank D Lombardo" <Frank@NoSpam.com> wrote in message > news:O8nyEXTBEHA.1548@TK2MSFTNGP12.phx.gbl... > > I am attempting to use Reflection to send an object over a serial port. I > > won't know the exact type of the object until run-time. If I call > > GetFields(), is there any guarantee on the order the fields are returned? > > Would it help if I used a struct instead of a class? I need to send the > > fields in a known and consistent order. I would also like this code to > work > > on the Compact Framework. > > > > > > Thanks, > > -- > > Frank D. Lombardo > > Turning Point Technology, Inc. > > Frank_AT_TurningPointOnline_DOT_com > > > > > > > > > >
- Next message: Krzysztof Kazmierczak: "RE: Use of the ceAppMgr"
- Previous message: Krzysztof Kazmierczak: "RE: Use of the ceAppMgr"
- In reply to: Nicholas Paldino [.NET/C# MVP]: "Re: Reflection and order of the fields"
- Next in thread: Kevin P. Fleming: "Re: Reflection and order of the fields"
- Reply: Kevin P. Fleming: "Re: Reflection and order of the fields"
- Reply: Ignacio Machin \( .NET/ C# MVP \): "Re: Reflection and order of the fields"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|