I want to combine two IList
's into one, either of which, or both, could be null
. If both are null
I want the result to be null
.
I have this but I want something more elegant but still easy to read.
private IList<Filter> CombineFilters(IList<Filter> first, IList<Filter> second)
{
IList<Filter> result = null;
if(first != null)
if (second != null)
result = first.Concat(second) as IList<Filter>;
else
result = first;
else if (second != null)
result = second;
return result;
}