List.Find
returns a single item from the list, but your
IService1.get
has
List<Customer>
as it's return type.
Change the return type to
string
;
Customer IService1.get(string str)
{
var result = cutomerList.Find(x => x.CustomerName == str);
return result;
}
You're looking for a single item so it makes no sense for the method to return a list of items.
List<T>.Find
finds a single item (or none), so your method needs to return the same type.
Hope this helps,
Fredrik