# NativeText.ReadOnly

> A read-only alias for the value of a NativeText. Does not have its own allocated storage.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule
* **Implements:** [INativeList\<byte>](/engine/6000.7/script-reference/unity/collections/inativelist1.md), [IIndexable\<byte>](/engine/6000.7/script-reference/unity/collections/iindexable1.md), [IUTF8Bytes](/engine/6000.7/script-reference/unity/collections/iutf8bytes.md), [IComparable\<string>](https://learn.microsoft.com/dotnet/api/system.icomparable-1), [IEquatable\<string>](https://learn.microsoft.com/dotnet/api/system.iequatable-1), [IComparable\<NativeText>](https://learn.microsoft.com/dotnet/api/system.icomparable-1), [IEquatable\<NativeText>](https://learn.microsoft.com/dotnet/api/system.iequatable-1), [IComparable\<FixedString32Bytes>](https://learn.microsoft.com/dotnet/api/system.icomparable-1), [IEquatable\<FixedString32Bytes>](https://learn.microsoft.com/dotnet/api/system.iequatable-1), [IComparable\<FixedString64Bytes>](https://learn.microsoft.com/dotnet/api/system.icomparable-1), [IEquatable\<FixedString64Bytes>](https://learn.microsoft.com/dotnet/api/system.iequatable-1), [IComparable\<FixedString128Bytes>](https://learn.microsoft.com/dotnet/api/system.icomparable-1), [IEquatable\<FixedString128Bytes>](https://learn.microsoft.com/dotnet/api/system.iequatable-1), [IComparable\<FixedString512Bytes>](https://learn.microsoft.com/dotnet/api/system.icomparable-1), [IEquatable\<FixedString512Bytes>](https://learn.microsoft.com/dotnet/api/system.iequatable-1), [IComparable\<FixedString4096Bytes>](https://learn.microsoft.com/dotnet/api/system.icomparable-1), [IEquatable\<FixedString4096Bytes>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public struct NativeText.ReadOnly : INativeList<byte>, IIndexable<byte>, IUTF8Bytes, IComparable<string>, IEquatable<string>, IComparable<NativeText>, IEquatable<NativeText>, IComparable<FixedString32Bytes>, IEquatable<FixedString32Bytes>, IComparable<FixedString64Bytes>, IEquatable<FixedString64Bytes>, IComparable<FixedString128Bytes>, IEquatable<FixedString128Bytes>, IComparable<FixedString512Bytes>, IEquatable<FixedString512Bytes>, IComparable<FixedString4096Bytes>, IEquatable<FixedString4096Bytes>
```

## Properties

| Property                                                                                      | Description                                   |
| --------------------------------------------------------------------------------------------- | --------------------------------------------- |
| [Capacity](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/capacity.md) | The current capacity in bytes of this string. |
| [IsEmpty](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/isempty.md)   | Whether this string has no characters.        |
| [this\[\]](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/item.md)     | The byte at an index.                         |
| [Length](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/length.md)     | The current length in bytes of this string.   |
| [Value](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/value.md)       | A copy of this string as a managed string.    |

## Methods

| Method                                                                                                  | Description                                                                                                                             |
| ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| [Clear](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/clear.md)                 | Sets the length to 0. For a NativeText.Readonly this function does nothing, unless safety checks are enabled (in which case it throws). |
| [CompareTo](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/compareto.md)         | Returns the lexicographical sort order of this string relative to another.                                                              |
| [ElementAt](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/elementat.md)         | Returns a reference to the byte (not character) at an index. Unsupported by NativeText.ReadOnly.                                        |
| [Equals](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/equals.md)               | Returns true if this string and another object are equal.                                                                               |
| [GetEnumerator](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/getenumerator.md) | Returns an enumerator for iterating over the characters of the NativeText.                                                              |
| [GetHashCode](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/gethashcode.md)     | Returns a hash code of this string.                                                                                                     |
| [GetUnsafePtr](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/getunsafeptr.md)   | Returns a pointer to this string's character buffer.                                                                                    |
| [ToString](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/tostring.md)           | Returns a managed string copy of this string.                                                                                           |
| [TryResize](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/tryresize.md)         | Attempt to set the length in bytes of this string. For NativeText.ReadOnly this function is a no-op and always returns false.           |

## Operators

| Operator                                                                                              | Description                              |
| ----------------------------------------------------------------------------------------------------- | ---------------------------------------- |
| [operator ==](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/op-equality.md)   | Returns true if two strings are equal.   |
| [operator !=](/engine/6000.7/script-reference/unity/collections/nativetext/readonly/op-inequality.md) | Returns true if two strings are unequal. |
