When I use C# Array.ConvertAll
, the variable in the body of the converter function is not visible any more in the debugger in Visual Studio 2017.
For example in:
public static void Test()
{
Vector3[] OriginalArray = new Vector3 [3]{ new Vector3(1,2,3), new Vector3(4, 5, 6), new Vector3(7, 8, 9)};
int[] Indices = new int[2] { 2, 1};
Vector3[] SelectedArray = Array.ConvertAll(Indices, index => OriginalArray[index]);
}
The variable OriginalArray
is not visible in the debugger "Local"/"Autos"/"Watch"-window.
While the variable is visible when used in the manner as in the code below:
public static void Test2()
{
Vector3[] OriginalArray = new Vector3[3] { new Vector3(1, 2, 3), new Vector3(4, 5, 6), new Vector3(7, 8, 9) };
int[] Indices = new int[2] { 2, 1 };
List<Vector3> subverticesList = new List<Vector3>();
foreach (int index in Indices)
{
subverticesList.Add(OriginalArray[index]);
}
Vector3[] SelectedArray = subverticesList.ToArray();
}