public override int GetHashCode() { int hashFirstName = Name == null ? 0 : Name.GetHashCode(); int hashLastName = Jmbag == null ? 0 : Jmbag.GetHashCode(); return(hashFirstName ^ hashLastName); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (string.IsNullOrEmpty(Jmbag) || Jmbag.Length != 10 || !Jmbag.All(_ => char.IsDigit(_))) { yield return(new ValidationResult("JMBAG se mora sastojati od 10 znamenki", new[] { "Jmbag" })); } }
public override int GetHashCode() { int hashName = Name.GetHashCode(); int hashJmbag = Jmbag.GetHashCode(); return(hashName ^ hashJmbag); }
public bool Equals(Student another) { if (Jmbag.Equals(another.Jmbag)) { return(true); } return(false); }
public override bool Equals(object obj) { if (!(obj is Student objAStudent)) { return(false); } return(Jmbag.Equals(objAStudent.Jmbag)); }
public bool Equals(Student s) { if (Jmbag.Equals(s.Jmbag)) { return(true); } return(false); }
public override bool Equals(object obj) { if (obj == null || Jmbag == null) { return(false); } return(Jmbag.Equals(((Student)obj).Jmbag)); }
public override int GetHashCode() { int hashName = Name == null ? 0 : Name.GetHashCode(); int hashJmbag = Jmbag == null ? 0 : Jmbag.GetHashCode(); int hash = hashName ^ hashJmbag; return(hash); }
public override int GetHashCode() { unchecked { var hashCode = (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Jmbag != null ? Jmbag.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)Gender; return(hashCode); } }
public override bool Equals(object obj) { if (obj is Student) { Student student1 = (Student)obj; return(Name.Equals(student1.Name) && Jmbag.Equals(student1.Jmbag) && (Gender == student1.Gender)); } return(false); }
public override bool Equals(object obj) { var student = obj as Student; if (ReferenceEquals(student, null)) { return(false); } return(Jmbag.Equals(student.Jmbag)); }
public override int GetHashCode() { if (Name == null || Jmbag == null) { return(0); } else { return(Name.GetHashCode() ^ Jmbag.GetHashCode()); } }
public override int GetHashCode() { // If two products are equal, they will have the same hash code. // Two products are equal if their ID matches, so the easiest way to do this is // just to return the Id.GetHashCode(). return(Jmbag.GetHashCode()); }
public override bool Equals(object obj) { var item = obj as Student; if (item == null) { return(false); } return(Jmbag.Equals(item.Jmbag) && Name.Equals(item.Name) && Gender.Equals(item.Gender)); }
public IDictionary <string, string> Validate() { var errors = new Dictionary <string, string>(); if (string.IsNullOrEmpty(Jmbag) || Jmbag.Length != 10 || !Jmbag.All(_ => char.IsDigit(_))) { errors.Add(nameof(Jmbag), "Invalid JMBAG."); } if (string.IsNullOrWhiteSpace(Firstname)) { errors.Add(nameof(Firstname), "Firstname is required."); } if (string.IsNullOrWhiteSpace(Lastname)) { errors.Add(nameof(Lastname), "Lastname is required."); } return(errors); }
public override int GetHashCode() => Jmbag.GetHashCode();
public override int GetHashCode() { return(Jmbag.GetHashCode()); }
public override int GetHashCode() { return(Name.GetHashCode() * 17 + Jmbag.GetHashCode()); }
public override int GetHashCode() { int i = Gender == Gender.Male ? 1 : 0; return(Name.GetHashCode() + Jmbag.GetHashCode() + i + 7); }
public override int GetHashCode() { unchecked { return(((Name != null ? Name.GetHashCode() : 0) * 397) ^ (Jmbag != null ? Jmbag.GetHashCode() : 0)); } }
public override int GetHashCode() { unchecked { // Choose large primes to avoid hashing collisions const int HashingBase = (int)2166136261; const int HashingMultiplier = 16777619; int hash = HashingBase; hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, Name) ? Name.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, Jmbag) ? Jmbag.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, Gender) ? Gender.GetHashCode() : 0); return(hash); } }
public override int GetHashCode() { return(Jmbag.GetHashCode() * Name.GetHashCode() * Gender.GetHashCode()); }
public override bool Equals(object obj) { var stud = obj as Student; return(stud != null && Jmbag.Equals(stud.Jmbag)); }