Should I use a Class or Dictionary to Store Form Values

Posted by Shamim Hafiz on Programmers See other posts from Programmers or by Shamim Hafiz
Published on 2011-02-01T07:29:30Z Indexed on 2011/02/01 7:32 UTC
Read the original article Hit count: 324

Filed under:
|
|
|

I am working on a C# .NET Application, where I have a Form with lots of controls. I need to perform computations depending on the values of the controls. Therefore, I need to pass the Form values to a function and inside that function, several helper functions will be called depending on the Control element.

Now, I can think of two ways to pass all the Form values:

i) Save everything in a Dictionary and pass the Dictionary to the function or ii) Have a class with attributes that corresponds to each of the Form element.

Which of these two approaches , or any other, is better?

© Programmers or respective owner

Related posts about c#

Related posts about classes