c# - ObservableCollection Enumerator with filter -
i need filter out items observable collection. previously, ienumerable, doing:
private ienumerable _mycollection {get; set;} public ienumerator<mytype> getenumerator() { var filteredtype = _mycolletion.where(t => t.myproperty.state != states.needsdelete); return filteredtype.getenumerator(); } system.collections.ienumerator system.collections.ienumerable.getenumerator() { return getenumerator(); }
i'm using observablecollection
. how implement same thing?
edit (context):
i'm keeping track of entities, working them in memory, , idea that, @ end, push these entities web service. each object in observable collection have state, such "needscreate", "needsdelete", "needsupdate" or unchanged. then, go through each of these states , call appropriate web service synchronize these changes.
well observalbecollection inherit collection , on ienumerable. "exact same way" be:
var collection = new observablecollection<type>(); public ienumerator<type> getenumerator() { return collection .where(i => i.property.state != states.needsdelete) .getenumerator(); }
maybe i'm interpreting wrong way. you're trying achieve?
Comments
Post a Comment