public int CompareTo(object obj) { AaSequence other = (AaSequence)obj; int min = Math.Min(sequence.Length, other.sequence.Length); for (int i = 0; i < min; i++) { if (sequence[i] != other.sequence[i]) { if (sequence[i] < other.sequence[i]) { return(-1); } return(1); } } if (sequence.Length != other.sequence.Length) { if (sequence.Length < other.sequence.Length) { return(-1); } return(1); } if (Length != other.Length) { if (Length < other.Length) { return(-1); } return(1); } return(0); }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj is AaSequence) { AaSequence other = (AaSequence)obj; if (other.Length != Length) { return(false); } for (int i = 0; i < sequence.Length; i++) { if (sequence[i] != other.sequence[i]) { return(false); } } return(true); } return(false); }