I have two functions:
public List<string> getAllProperties1()
{
List<string> output = new List<string>();
foreach (MyItem item in getItems())
{
if (!output.Contains(item.property1) &&
item.property1 != null)
{
output.Add(item.property1);
}
}
return output;
}
public List<string> getAllProperties2()
{
List<string> output = new List<string>();
foreach (MyItem item in getItems())
{
if (!output.Contains(item.property2) &&
item.property2 != null)
{
output.Add(item.property2);
}
}
return output;
}
I renamed functions, items and properties to make things more simple. What I want to do is one function, may be even more simple - instead of these two. How to achieve this?
Property1 and Property 2 are both string properties.