Ok, so I have a List of Strings availabe within an object. But there are more than just those strings in the object. But I only need those strings to be passed as a List<string> to method. How to get those strings only?
For Example, I have a following object _Home
With tons of tons of information in it to be able to get. But I only want the following strings:
_Home.String1
_Home.String2
_Home.String3
_Home.String4
_Home.String5
_Home.String6
Instead of creating a new List<string>() and adding each value into it separately, is there a way to create a method for this to be able to just do something like this?
List<String> theStrings = CreateStringList(_Home.String1, _Home.String2, _Home.String3, _Home.String4, _Home.String5, _Home.String6);
And than just pass theStrings into another method, like this: LoadData(theStrings)
I would like to be able to use this List as follows:
private void LoadData(List<string> theStrings)
{
theStrings.String1;
theStrings.String2;
// etc. etc.
}
List<string>or something similar already?List<string>astheStrings.String1... but you would be able to usetheStrings[0]etc.