The MinValue
property of the MinMaxAttribute
class specifies the minimum allowable value for a property that is decorated with this attribute. This is useful for ensuring that a property value does not fall below a certain threshold.
The MinValue
property of the MinMaxAttribute
class specifies the minimum allowable value for a property that is decorated with this attribute. This is useful for ensuring that a property value does not fall below a certain threshold.
To use the MinValue
property, apply the MinMaxAttribute
to a property in your class and specify the minimum value. This will enforce a constraint on the property, ensuring that its value is not set below the specified minimum.
// Example of using MinMaxAttribute with MinValue public class ExampleComponent : Component { [MinMax(0.0f, 100.0f)] public float Health { get; set; } public ExampleComponent() { Health = 50.0f; // Initial value within the specified range } }