I have a static list that contains objects of a class.
List<Hooking>
The object Hooking
has an instance property named HookingAreaRadius
. When I change the HookingAreaRadius
by the following code
List[i].HookingAreaRadius = 0.5
every HookingAreaRadius of every object in the list is set to 0.5. Firstly, why is that? And secondly, how can the property of the object (accessed via the static list) be set individually?
Side note: The Hooking object has many instance properties, so I cannot simply instantiate a new object.
I tried this:
public Hooking SetHookingAreaRadius(double hookingAreaRadius)
{
var cloned = (Hooking)MemberwiseClone();
cloned.HookingAreaRadius = hookingAreaRadius;
return cloned;
}
But this resulted in bizarre side effects.
Any help is appreciated!