I have a requirement wherein I have a value in Viewbag.Keyword like "Johnson and Jen" so I have to split this value and compare it with List.
I was trying the below code but facing error some or the other way(eg; this is char not string and so on) and it doesn't look like smart coding as per latest functionalities available in framework 4.5
var str = Convert.ToString(ViewBag.Keyword);
string[] str1 = str.Split(' ');
for (int j = 0; j < str1.Length;j++)
{
string str2 = Convert.ToString(str[j]);
if (result.Document.ContactName.IndexOf(str2,
StringComparison.CurrentCultureIgnoreCase) != -1)
Note: "ContactName" is string. Please help with some latest code which improves performance.