I got collection of structures with string property. Given an array of strings I want to check if there is any structure which inner string matches some of them in the array. I did it in this way:
struct S
{
public string s { get; set; }
}
private List<S> List = new List<S>(); // populated somewhere else
public bool Check(params string[] arr)
{
return (from s1 in List
select s1.s into s1
where !string.IsNullOrEmpty(s1)
join s2 in arr on s1.ToLowerInvariant() equals s2.ToLowerInvariant() select s1).Any();
}
Simply, I just want to achieve StringComparison.InvariantCultureIgnoreCase. Is it a proper way to do so? Is it efficient?