# LockedAttribute

Kind: Class · Namespace: Sansar.Script · Assembly: Sansar.Script.dll · Script API 47.10.0

<div class="api-meta">
<span class="api-kind api-kind-class" data-pagefind-filter="kind:Class">Class</span>
<span data-pagefind-filter="namespace:Sansar.Script">Namespace <a href="/scripting/api/sansar.script"><code>Sansar.Script</code></a></span>
<span>Inherits <a href="https://learn.microsoft.com/dotnet/api/system.attribute">Attribute</a></span>
</div>

<span id="T:Sansar.Script.LockedAttribute"></span>

Locks the IDictionary or IList properties so entries can not be added or removed.

```csharp
[System.AttributeUsage(System.AttributeTargets.Field)]
public class LockedAttribute : Attribute
```

## Remarks

Should be used in conjunction with [`EntriesAttribute`](/scripting/api/sansar.script/entriesattribute) or [`AddEntryAttribute`](/scripting/api/sansar.script/addentryattribute).

## Members at a glance

| Kind | Members |
|---|---|
| **Constructors** | [LockedAttribute](#lockedattribute) |

## Constructors

### LockedAttribute

<div class="api-card">
<span id="M:Sansar.Script.LockedAttribute.#ctor"></span>
<span id="C:Sansar.Script.LockedAttribute()"></span>

```csharp signature
public LockedAttribute()
```

Locks the IDictionary or IList properties so entries can not be added or removed.

<details class="api-remarks"><summary>Remarks</summary>

Should be used in conjunction with [`EntriesAttribute`](/scripting/api/sansar.script/entriesattribute) or [`AddEntryAttribute`](/scripting/api/sansar.script/addentryattribute).

IDictionary keys will be unchangeable and entries can not be added or removed.

IList entries can not be added or removed.

Will not prevent values from being modified in either case.

Has no effect on other parameter types.

</details>

<details class="api-example" open><summary>Example</summary>

```csharp
[Locked]
public IList<float>floatList;
```

</details>

</div>




<p class="api-generated" data-pagefind-ignore>Generated from the Sansar 47.10.0 client ScriptApi snapshot.</p>