c# – Setting a tuple causes stackoverflow error. How to Set a tuple property?
This is not about a tuple this is about properties in general.
Both the get
ter and set
ter or your property BoundsTuple
refer to the very same BoundsTuple
property again.
You will either convert this to an auto-property
public (float minX, float maxX, float minY, float maxY) BoundsTuple { get; set; }
or introduce a backing field
privte (float minX, float maxX, float minY, float maxY) _boundsTuple;
public (float minX, float maxX, float minY, float maxY) BoundsTuple
{
get => _boundsTuple;
set => _boundsTuple= value;
}
Read more here: Source link