Resetting all object variables in c#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I wont to reset all the variables in a c# object at run time, I was hoping
for a field collection or some similar method of iterating through the
variables.

Any ideas ???
 
lee said:
I wont to reset all the variables in a c# object at run time, I was hoping
for a field collection or some similar method of iterating through the
variables.

Any ideas ???

Well, you could use reflection. It won't be terribly fast though...
 
Dennis Myrén said:
Why not having a Reset something method on that object, doing it for you.

Yes, that's certainly the better bet if you are in control of the type.
Of course it means you've got to modify the method every time you add a
field, too. I was assuming that the OP didn't want to do that for
whatever reason, but I think they'd have to be pretty good reasons :)
 
Back
Top