コード例 #1
0
ファイル: NameSample.cs プロジェクト: dheeraj-thedev/SharpNL
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 /// A hash code for the current <see cref="T:NameSample"/>.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked {
         int hashCode = (AdditionalContext != null ? AdditionalContext.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ClearAdaptiveData.GetHashCode();
         hashCode = (hashCode * 397) ^ (Names != null ? Names.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Sentence != null ? Sentence.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #2
0
ファイル: NameSample.cs プロジェクト: dheeraj-thedev/SharpNL
        /// <summary>
        /// Determines whether the specified <see cref="T:NameSample"/> is equal to the current <see cref="T:NameSample"/>.
        /// </summary>
        /// <returns>
        /// true if the specified object is equal to the current object; otherwise, false.
        /// </returns>
        /// <param name="other">The other <see cref="NameSample"/> to compare with the current object. </param>
        protected bool Equals(NameSample other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Sentence.SequenceEqual(other.Sentence) &&
                   Names.SequenceEqual(other.Names) &&
                   AdditionalContext.SequenceEqual(other.AdditionalContext) &&
                   ClearAdaptiveData == other.ClearAdaptiveData);
        }