I have two strings consisting of several words (Comma separated). If string 1 consisting of words (; separated) which is to be ignored if it presents in string 2, below are the strings
var compToIgnore="Samsung,Motorola,Amazon";
var allCompanies="Godrej,Samsung,Videocon,Huawei,Motorola,Alibaba,Amazon";
var icm = compToIgnore.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var c in listOfCompanies)
{
if (c.BrandId.StartsWith("A2"))
{
var item = allCompanies.Where(x => !icm.Contains(x));
var result = string.Join(",", item);
}
}
In result variable I wanted to have final result as "Godrej,Videocon,Huawei,Alibaba"
I don't see any proper result with above code