The answer to this question might be super obvious to anyone, but at the moment I'm having an issue trying to figure out how to access a List made in a previous class.
Here's what I'm doing currently, which causes the error "An object reference is required for the non-static field, method, or property 'TestClass.TestList'".
public partial class TestClass
{
// Make a static list
public static List<string> TestStaticList = new List<string>();
// Make a non-static list - How do I reference this?
public List<string> TestList { get; set; }
// Clear the static list, and add the entries of the non-static list
public static void UpdateList()
{
TestStaticList.Clear();
for (int i = 0; i < TestList.Count; i++)
{
string NewString = TestList[i];
TestStaticList.Add(NewString);
}
}
}
My question is just how can do I reference that List? It's worth noting that I do need it to remain non-static. I've looked around for information regarding this but so far either I've not found any or I didn't notice it to be a solution to my issue, so I'm sorry if this is a duplicate. Thanks in advance for any help.