In a C# Winforms (3.5) application I have added a class that contains many properties (get/set) used to stored values from a 12 form long process.
After form 12 I would like wipe out all the property values in the storing class so that the next user won’t accidentally record values when starting the process at form 1.
Is it possible to erase/destroy/dispose of all property values in a class?
My class looks like this:
private static int battery;
public int Battery
{
get { return storeInspectionValues.battery; }
set { storeInspectionValues.battery = value; }
}
Can you create a new instance of the class instead? You will end up with exactly the same object.
Edit in response to comments:
Let’s say this is your class:
You say you want to “erase/destroy/dispose of all property values in a class”. I assume this means you would like to reset all properties to their default values. That implies something like this:
The same can be accomplished by doing this:
Now
foois an instance whose properties all have their default values. Does that solve your problem?