Foreach loop doesn't finish in c# with List<> -
i know it's strange don't find way it. please see image below 

the output 1 , it's same!
i don't understand happend here. can explain me?
just couple of observations on modelo , medicion classes:
public class modelo<t> { // 1) note protected set on id public virtual int id { get; protected set; } public override bool equals(object obj) { ... // 2) comparison based on id return (this == obj || this.id == specificoject.id); } ... } public class medicion : modelo<medicion> {...} - the
idmember definedprotected set. - the
equalsmethod defines 2 objects same ifidin both same.
are setting id of medicion objects anywhere? if not, 0. if ids same, makes objects same (your equality definition based on id).
therefore, mediciones.contains true after first object added. don't provide info on mediciones, assuming here standard list no overrides.
Comments
Post a Comment