Reputation: 91
Actually I want to reset the SpintexEditorProperty class. This contains the static properties. I want to reset all those properties so that i set new instance but it is not functioning... Please help me... Thanks in advance!
//Reset the SpintexEditorPropertyMain
internal static void ResetSpintexEditorPropertyMain()
{
SpintexEditorPropertyMain = new SpintexEditorProperty();
}
Upvotes: 0
Views: 107
Reputation: 32661
Static properties are not reset when you create a new instance of the class containing those properties. Static fields are meant to remain the same for all the instances of that class.
if you want to reset their values you will have to do them explicitly. Something like this.
public static void ResetStaticProperties()
{
SpintexEditorProperty.Property1 = 0;
SpintexEditorProperty.Property2 = 0;
SpintexEditorProperty.Property3 = 0;
}
and call this method whereever you want to reset them
Upvotes: 1
Reputation: 678
If class contains static properties then directly access the properties, you don't have to create a new instance to change static properties
Example SpintexEditorProperty.propertyname = null, this will reset the property
Upvotes: 2