Foreach loop doesn't finish in c# with List<> -


i know it's strange don't find way it. please see image below count list

enter image description here

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> {...} 
  1. the id member defined protected set.
  2. the equals method defines 2 objects same if id in 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

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -