Hello,
I have a ‘scenario’ where I would like to create a function inside a List that would return specific data from the list. Here is an example…
public class C1 {
public class C2 {
public String S1;
public String S2;
}
public List<C2> c2List = new List<C2>();
}
c2List is a list of data that has the S1 and S2 ‘properties’ (as Strings) per element, and I would like to create a function to where I can call…
c2List.getS1OnlyFromList();
straight from the list, and have something in the getS1OnlyFromList() function like…
public List<String> getS1OnlyFromList() {
List<String> returnStringList = new List<String>();
returnStringList.Clear();
for (int i = 0; i < this.Count; i++) {
returnStringList.Add(this[i].S1);
}
return returnStringList;
}
How would I set something up like this? Wouldn’t this be a good idea?
Thank you,
Michael S. Lowe