Healthcare IT Blog

A place to blog about Healthcare Informatics Software Development Implementations

image
Get matching strings in two string collections? C# Script

By Technical Team Technosoft |21 August 2014

This function will return the list of strings that are same in both string collections.

 public static List<string> GetMatchedStrings(string[] string1, string[] string2)
{

List<string> lstMatch =
(from string str1 in string1
join string str2 in string2 on str1.ToUpper() equals str2.ToUpper()
select str1).ToList<string>();

return lstMatch;