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

How to Share webservice object to all user

How to fix error Msg 1801, Level 16, State 3, Line 1