-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
Hi, I executed this simple test in Unity and the ToList() doesn't work well... ?!
public List<InboxItem> _firstList = null;
public class InboxItem
{
public int int1;
public float float1;
public int int2;
}
//I just initialize the list with 10.000 items
private void Start()
{
_firstList = new List<InboxItem>(100000);
for (int i = 0; i < 100000; i++)
{
_firstList.Add(new InboxItem()
{
int1 = i,
float1 = i,
int2 = 2 * i
});
}
}
private void TestSelectThenToListHyperLinq()
{
Debug.Log("TestSelectThenToListHyperLinq");
var select = _firstList.AsValueEnumerable().Select(x => x.int1);
var list = select.ToList();
var array = select.ToArray();
Debug.Log("list count = " + list.Count); //return 0 !!!!
Debug.Log("array Length = " + array.Length); //return n
}
private void TestSelectThenToListLinq()
{
Debug.Log("TestSelectThenToListLinq");
var select = _firstList.Select(x => x.int1);
var list = select.ToList();
var array = select.ToArray();
Debug.Log("list count = " + list.Count); //return n
Debug.Log("array Length = " + array.Length); //return n
}
Metadata
Metadata
Assignees
Labels
No labels