# RangeAttribute

### RangeAttribute Class

Specify a range of valid values for the field in script properties.

### Syntax

\[System.AttributeUsage(System.AttributeTargets.Field)]\
public class **RangeAttribute** : [Attribute](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Attribute)

### Member Details

#### RangeAttribute Constructor

> Specify the allowed range of values for a field using named arguments.
>
> #### Syntax
>
> public **RangeAttribute** ()
>
> #### Remarks
>
> #### Example

<table data-header-hidden><thead><tr><th></th></tr></thead><tbody><tr><td><strong>C# Example</strong></td></tr><tr><td><pre><code>            [Range(Min=-10.0, Max=10.0)]
</code></pre></td></tr></tbody></table>

```
        public float namedRangeFloat;
        
```

|

> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### RangeAttribute Constructor

> Specify the allowed range of values for a float or double field.
>
> #### Syntax
>
> **Parameters**
>
> > *min*
> >
> > The lower bound on the range. Default: 0.0f
> >
> > *max*
> >
> > The upper bound on the range. Default: 0.0f
>
> #### Remarks
>
> #### Example

<table data-header-hidden><thead><tr><th></th></tr></thead><tbody><tr><td><strong>C# Example</strong></td></tr><tr><td><pre><code>            [Range(-10.0, 10.0)]
</code></pre></td></tr></tbody></table>

```
        public float namedRangeFloat;
        
```

|

> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### RangeAttribute Constructor

> Specify the allowed range of values for an int field.
>
> #### Syntax
>
> public **RangeAttribute** ([int](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int32) min, [int](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int32) max)
>
> **Parameters**
>
> > *min*
> >
> > The lower bound on the range. Default: 0
> >
> > *max*
> >
> > The upper bound on the range. Default: 0
>
> #### Remarks
>
> #### Example

<table data-header-hidden><thead><tr><th></th></tr></thead><tbody><tr><td><strong>C# Example</strong></td></tr><tr><td><pre><code>            [Range(-10, 10)]
</code></pre></td></tr></tbody></table>

```
        public int rangeInt;
        
```

|

> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Max Property

> Used with default constructor to specify the upper bound on the range.
>
> #### Syntax
>
> public [object](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Object) **Max** { get; set; }
>
> **Value**
>
> > The maximum allowed value for the parameter.
>
> #### Remarks
>
> #### Example

<table data-header-hidden><thead><tr><th></th></tr></thead><tbody><tr><td><strong>C# Example</strong></td></tr><tr><td><pre><code>            [Range(Min=-10.0, Max=10.0)]
</code></pre></td></tr></tbody></table>

```
        public float rangeFloat;
        
```

|

> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Min Property

> Used with default constructor to specify the lower bound on the range.
>
> #### Syntax
>
> public [object](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Object) **Min** { get; set; }
>
> **Value**
>
> > The minimum allowed value for the parameter.
>
> #### Remarks
>
> #### Example

<table data-header-hidden><thead><tr><th></th></tr></thead><tbody><tr><td><strong>C# Example</strong></td></tr><tr><td><pre><code>            [Range(Min=-10.0, Max=10.0)]
</code></pre></td></tr></tbody></table>

```
        public float rangeFloat;
        
```

|

> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sansar.com/latest/script-api-docs/sansar-script-namespace/rangeattribute.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
