# SetKeyOrder(IReadOnlyList<long>)

> Reorders the keys to match a given sequence of ids.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Localization](/engine/6000.7/script-reference/unity/localization.md)
* **Assembly:** UnityEngine.LocalizationRuntimeModule

```csharp
public void SetKeyOrder(IReadOnlyList<long> orderedIds)
```

### Parameters

**** (\[IReadOnlyList\<long>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1)): The desired key-id order.

### Remarks

Keys are arranged in the order their ids appear in `orderedIds`. Ids that are not listed keep their relative order and follow the listed keys. A null or empty list leaves the order unchanged.

Additional Resources: [SharedTableData.Entries](/engine/6000.7/script-reference/unity/localization/sharedtabledata/entries.md)

Move a key to the front by listing its id first.

### Examples

```csharp
using System.Collections.Generic;
using Unity.Localization;
using UnityEngine;

namespace Unity.Localization.Samples
{
    public class SharedTableDataSetKeyOrderExample
    {
        public void Run()
        {
            var sharedData = ScriptableObject.CreateInstance<SharedTableData>();
            long a = sharedData.AddKey("A").Id;
            long b = sharedData.AddKey("B").Id;

            sharedData.SetKeyOrder(new List<long> { b, a });   // B now comes first

            Debug.Log(sharedData.Entries[0].Key);   // B
        }
    }
}
```
