Hi rani,
Check this example. Now please take its reference and correct your code.
Controller
public class HomeController : Controller
{
public IActionResult Index()
{
List<string> list1 = new List<string> { "a", "b", "c" };
List<string> list2 = new List<string> { "A", "c", "F", "x" };
List<string> others = Compare(list1, list2);
return View();
}
public List<string> Compare(List<string> list1, List<string> list2)
{
List<string> result = new List<string>();
result.AddRange(list1.Except(list2, StringComparer.OrdinalIgnoreCase));
result.AddRange(list2.Except(list1, StringComparer.OrdinalIgnoreCase));
return result;
}
}
Screenshot