Description
The Deconstruct
method is a member of the RangedFloat
struct. It allows you to deconstruct a RangedFloat
instance into its minimum and maximum values. This method is particularly useful for tuple deconstruction, enabling you to easily extract the range values into separate variables.
Usage
To use the Deconstruct
method, you need to have an instance of RangedFloat
. You can then call this method to deconstruct the instance into two separate float
variables representing the minimum and maximum values of the range.
The method signature is as follows:
public void Deconstruct(out float min, out float max)
Both min
and max
are output parameters that will be assigned the respective values from the RangedFloat
instance.
Example
// Example of using the Deconstruct method
RangedFloat rangedFloat = new RangedFloat { Min = 1.0f, Max = 5.0f };
rangedFloat.Deconstruct(out float min, out float max);
// Now min is 1.0f and max is 5.0f
// Alternatively, using tuple deconstruction
(float min, float max) = rangedFloat;
// min and max will have the values 1.0f and 5.0f respectively.