# MoveArrayElement(int, int)

> Move an array element from srcIndex to dstIndex.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

```csharp
public bool MoveArrayElement(int srcIndex, int dstIndex)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): **** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)):&#x20;

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

Additional Resources: [SerializedProperty.isArray](/engine/6000.0/script-reference/unityeditor/serializedproperty/isarray.md), [SerializedProperty.InsertArrayElementAtIndex](/engine/6000.0/script-reference/unityeditor/serializedproperty/insertarrayelementatindex.md), [SerializedProperty.DeleteArrayElementAtIndex](/engine/6000.0/script-reference/unityeditor/serializedproperty/deletearrayelementatindex.md)

### Examples

```csharp
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class MoveArrayElementExample : ScriptableObject
{
    public List<string> m_Data;

    [MenuItem("Example/SerializedProperty/MoveArrayElementExample Example")]
    static void MenuCallback()
    {
        MoveArrayElementExample obj = ScriptableObject.CreateInstance<MoveArrayElementExample>();
        obj.m_Data = new List<string>() { "cat", "The", "jumped.", "big" };

        SerializedObject serializedObject = new SerializedObject(obj);
        SerializedProperty arrayProperty = serializedObject.FindProperty("m_Data");

        arrayProperty.MoveArrayElement(0, 1);
        arrayProperty.MoveArrayElement(3, 1);

        serializedObject.ApplyModifiedProperties();

        // Outputs "The big cat jumped."
        Debug.Log("Final array contents: " + string.Join(" ", obj.m_Data));
    }
}
```
