Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
GeneralRe: Deserialize old versions Pin
eggsovereasy6-Oct-08 10:47
eggsovereasy6-Oct-08 10:47 
QuestionWindow Manager Collection Pin
Kevin Marois6-Oct-08 8:09
professionalKevin Marois6-Oct-08 8:09 
AnswerRe: Window Manager Collection Pin
Mark Salsbery6-Oct-08 8:27
Mark Salsbery6-Oct-08 8:27 
GeneralRe: Window Manager Collection Pin
Kevin Marois6-Oct-08 9:56
professionalKevin Marois6-Oct-08 9:56 
QuestionRe: Window Manager Collection Pin
led mike6-Oct-08 10:01
led mike6-Oct-08 10:01 
GeneralRe: Window Manager Collection Pin
Mark Salsbery6-Oct-08 10:35
Mark Salsbery6-Oct-08 10:35 
QuestionDynamic setting of properties from data stream Pin
James R. Twine6-Oct-08 7:07
James R. Twine6-Oct-08 7:07 
AnswerRe: Dynamic setting of properties from data stream Pin
Wendelius6-Oct-08 7:58
mentorWendelius6-Oct-08 7:58 
If the object is created based on the info in the CSV-file, you could implement ISerializable interface, which allows you to control the serialization and deserialization.

If you only want to set the values of an existing object based on CSV input, I would create a method on each class (based on an interface) which sets the properties for the class and understands the input paranmeter (CSV string). The input string would be easiest to handle using String.Split-method.

In both cases you wouldn't need to use reflection.

If you want to use reflection, you would have a method with two (csv+object) mandatory parameters and a third one as parameter array, for properties list. In this case you would examine the type of the object and then find each property's PropertyInfo given in a parameter using object type's GetProperty method. After that you can use the SetValue method for the PropertyInfo t set the value of the property (just check that the property is writable).

Hope this helps,

Mika

The need to optimize rises from a bad design

AnswerRe: Dynamic setting of properties from data stream Pin
N a v a n e e t h6-Oct-08 8:00
N a v a n e e t h6-Oct-08 8:00 
GeneralRe: Dynamic setting of properties from data stream Pin
James R. Twine8-Oct-08 1:49
James R. Twine8-Oct-08 1:49 
AnswerRe: Dynamic setting of properties from data stream Pin
Mark Churchill6-Oct-08 17:12
Mark Churchill6-Oct-08 17:12 
GeneralRe: Dynamic setting of properties from data stream Pin
James R. Twine8-Oct-08 1:54
James R. Twine8-Oct-08 1:54 
QuestionData sending/receiving using a dial-up modem and C# Pin
ajorge20086-Oct-08 6:50
ajorge20086-Oct-08 6:50 
AnswerRe: Data sending/receiving using a dial-up modem and C# Pin
N a v a n e e t h6-Oct-08 7:11
N a v a n e e t h6-Oct-08 7:11 
AnswerRe: Data sending/receiving using a dial-up modem and C# Pin
Pedram Behroozi6-Oct-08 7:15
Pedram Behroozi6-Oct-08 7:15 
QuestionWhich is the most used programming language Pin
Christopher Clarke6-Oct-08 6:43
Christopher Clarke6-Oct-08 6:43 
AnswerRe: Which is the most used programming language Pin
User 66586-Oct-08 6:51
User 66586-Oct-08 6:51 
AnswerRe: Which is the most used programming language Pin
N a v a n e e t h6-Oct-08 7:22
N a v a n e e t h6-Oct-08 7:22 
GeneralRe: Which is the most used programming language Pin
led mike6-Oct-08 9:57
led mike6-Oct-08 9:57 
GeneralRe: Which is the most used programming language Pin
Guffa6-Oct-08 22:19
Guffa6-Oct-08 22:19 
AnswerRe: Which is the most used programming language PinPopular
#realJSOP6-Oct-08 8:00
mve#realJSOP6-Oct-08 8:00 
GeneralRe: Which is the most used programming language Pin
Paul Conrad6-Oct-08 9:50
professionalPaul Conrad6-Oct-08 9:50 
GeneralRe: Which is the most used programming language Pin
Pete O'Hanlon6-Oct-08 9:53
mvePete O'Hanlon6-Oct-08 9:53 
JokeRe: Which is the most used programming language Pin
Paul Conrad6-Oct-08 10:04
professionalPaul Conrad6-Oct-08 10:04 
GeneralRe: Which is the most used programming language Pin
DaveyM696-Oct-08 9:58
professionalDaveyM696-Oct-08 9:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.