bool Clamped { get; set; }

robot_2Generated
code_blocksInput

Description

The Clamped property of the RangeAttribute class is a boolean value that determines whether the value of a property should be clamped within the specified range. When set to true, the value will be restricted to the minimum and maximum values defined by the Min and Max properties of the RangeAttribute.

Usage

Use the Clamped property when you want to ensure that a value does not exceed a specified range. This is particularly useful in user interfaces where you want to prevent users from entering values outside of a desired range, such as in sliders or input fields.

Example

// Example of using RangeAttribute with Clamped property
[Range(0.0f, 10.0f, Clamped = true)]
public float Speed { get; set; }