Use var here, the compiler than will decide in the foreach loop from which type the SearchItem in the list is. In this example var is of type string/
SearchViewModel<string> vs = new SearchViewModel<string>(new List<string> { "1","2","3"});
foreach (var item in vs.SearchItems)
{
// logic, item in this case is string
}
solved Iterating through a generic list property