# CopyFrom

> Copies another string to this string (making the two strings equal).

## Definition

* **Type:** Method
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule

## CopyFrom\<T, U>(T, T)

Copies another string to this string (making the two strings equal).

```csharp
public static CopyError CopyFrom<T, T2>(this ref T fs, in T2 input) where T : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, INativeList<byte>, IUTF8Bytes
```

### Parameters

**** (T): The destination string.**** (T): The source string.

### Returns

| Type                                                                        | Description                                                                                                             |
| --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| [CopyError](/engine/6000.7/script-reference/unity/collections/copyerror.md) | CopyError.None if successful. Returns CopyError.Truncation if the source string is too large to fit in the destination. |

### Remarks

When the method returns an error, the destination string is not modified.

## CopyFrom\<T>(T, string)

Copies another string to this string (making the two strings equal). Replaces any existing content of the FixedString.

```csharp
[ExcludeFromBurstCompatTesting("Takes managed string")]
public static CopyError CopyFrom<T>(this ref T fs, string s) where T : unmanaged, INativeList<byte>, IUTF8Bytes
```

### Parameters

**** (T): The destination string.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The source string.

### Returns

| Type                                                                        | Description                                                                                                             |
| --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| [CopyError](/engine/6000.7/script-reference/unity/collections/copyerror.md) | CopyError.None if successful. Returns CopyError.Truncation if the source string is too large to fit in the destination. |

### Remarks

When the method returns an error, the destination string is not modified.
