# RefRW<T>

> RefRW stores a reference (with write access) to native memory

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule
* **Implements:** [IQueryTypeParameter](/engine/7000.0/script-reference/unity/entities/iquerytypeparameter.md)

```csharp
public readonly struct RefRW<T> : IQueryTypeParameter where T : struct, IComponentData
```

## Constructors

| Constructor                                                                                                                                                                     | Description                                                                      |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| [RefRW\`1(System.Byte\*,Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle)](/engine/7000.0/script-reference/unity/entities/refrw1/ctor.md#refrw\(byte*-atomicsafetyhandle\)) | Stores a safe reference a pointer to T                                           |
| [RefRW\`1(Unity.Collections.NativeArray\{\`0},System.Int32)](/engine/7000.0/script-reference/unity/entities/refrw1/ctor.md#refrw\(nativearrayt-int\))                           | Stores a safe reference to a component from an array of components at the index. |

## Properties

| Property                                                                    | Description                                                  |
| --------------------------------------------------------------------------- | ------------------------------------------------------------ |
| [IsValid](/engine/7000.0/script-reference/unity/entities/refrw1/isvalid.md) | Checks if the component exists on this entity.               |
| [ValueRO](/engine/7000.0/script-reference/unity/entities/refrw1/valuero.md) | Returns a read-only reference to the component value itself. |
| [ValueRW](/engine/7000.0/script-reference/unity/entities/refrw1/valuerw.md) | Returns a writable reference to the component value itself.  |

## Static Methods

| Method                                                                        | Description                                                                                                                     |
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| [Optional](/engine/7000.0/script-reference/unity/entities/refrw1/optional.md) | Stores a safe reference to a component from an array of components at the index. If the array is empty stores a null reference. |
