I’m following this article on how to build a Binary Tree in C# from msdn:
Microsoft Learn: Build skills that open doors in your career…(v=vs.80).aspx
But in Unity my code is producing the following error:
error CS0117: ‘System.Collections.ObjectModel.Collection >’ does not contain a definition for ‘Items’.
The offending code:
using System.Collections.ObjectModel;
public class NodeList<T> : Collection<Node<T>>
{
public NodeList() : base() { }
public NodeList(int initialSize)
{
for (int i = 0; i < initialSize; i++)
base.Items.Add(default(Node<T>));
}
....
}
Its the last line, which doesn’t recognize Items from the Collection class, even though it has Items: Collection<T> Class (System.Collections.ObjectModel) | Microsoft Learn
Also its not producing an error in visual studio… only the Unity editor. Is this a bug in the Unity editor or something of my own? Could someone try to reproduce this for me?