can anyone tell me how to create a list in one class and access it from another?
public class MyClass {
private List myList = new List();
public List GetList()
{
return myList;
}
}
You can have any anything there instead of string.
Now you can make an object of MyClass
and can access the public method where you have implemented to return myList
.
public class CallingClass {
MyClass myClass = new MyClass();
public void GetList()
{
List calledList = myClass.GetList();
///More code here...
}
}