public class MyClass {
private List<string> myList = new List<string>();
public List<string> 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<string> calledList = myClass.GetList();
///More code here...
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…