Should I use a Class or Dictionary to Store Form Values
- by Shamim Hafiz
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?