Basically how do I access the component of a structure in my Sorted List (keys are strings and values are the structure). The structure is Section and one of the components of it is called name. How do I access that component. linkedList.GetByIndex(i).name
doesn't work.
To illustrate my comment:
struct A
{
public string name;
}
static void Demo()
{
// using System.Collections.Generic;
SortedList<string, A> list = new SortedList<string, A>();
list.Add("k0", new A { name = "name0" });
var name0 = list.Values[0].name;
}
To access the first struct in the example list, use list.Values[0]
or list["k0"]
. You can then access the .name
property of the struct.