Why am I getting Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'System.Collections.ObjectModel.ObservableCollection'


i trying filter out collection this;

mycollection = mycollection.where(x => x.mydata.indexof(mystring) > -1);

although giving me error;

cannot implicitly convert type 'system.collections.generic.ienumerable' 'system.collections.objectmodel.observablecollection'. explicit conversion exists (are missing cast?)

thanks

if 'mycollection' observablecollection try following:

var result = mycollection.where(x => x.mydata.indexof(mystring) > -1).tolist();
mycollection = new observablecollection<yourtype>(result);

wizend



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'