GetHashCode() публичный Метод

public GetHashCode ( ) : int
Результат int
Пример #1
0
 public override int GetHashCode()
 {
     return(base.GetHashCode() ^ NameValueHeaderValue.GetHashCode(parameters));
 }
Пример #2
0
 public override int GetHashCode()
 {
     // The value string is case-insensitive.
     return(StringComparer.OrdinalIgnoreCase.GetHashCode(_value) ^ NameValueHeaderValue.GetHashCode(_parameters));
 }
Пример #3
0
        public void GetHashCode_ValuesUseDifferentValues_HashDiffersAccordingToRfc()
        {
            NameValueHeaderValue nameValue1 = new NameValueHeaderValue("text");
            NameValueHeaderValue nameValue2 = new NameValueHeaderValue("text");

            nameValue1.Value = null;
            nameValue2.Value = null;
            Assert.Equal(nameValue1.GetHashCode(), nameValue2.GetHashCode());

            nameValue1.Value = "token";
            nameValue2.Value = null;
            Assert.NotEqual(nameValue1.GetHashCode(), nameValue2.GetHashCode());

            nameValue1.Value = "token";
            nameValue2.Value = string.Empty;
            Assert.NotEqual(nameValue1.GetHashCode(), nameValue2.GetHashCode());

            nameValue1.Value = null;
            nameValue2.Value = string.Empty;
            Assert.Equal(nameValue1.GetHashCode(), nameValue2.GetHashCode());

            nameValue1.Value = "token";
            nameValue2.Value = "TOKEN";
            Assert.Equal(nameValue1.GetHashCode(), nameValue2.GetHashCode());

            nameValue1.Value = "token";
            nameValue2.Value = "token";
            Assert.Equal(nameValue1.GetHashCode(), nameValue2.GetHashCode());

            nameValue1.Value = "\"quoted string\"";
            nameValue2.Value = "\"QUOTED STRING\"";
            Assert.NotEqual(nameValue1.GetHashCode(), nameValue2.GetHashCode());

            nameValue1.Value = "\"quoted string\"";
            nameValue2.Value = "\"quoted string\"";
            Assert.Equal(nameValue1.GetHashCode(), nameValue2.GetHashCode());
        }
Пример #4
0
 public void GetHashCode_NameUseDifferentCasing_HashDiffersAccordingToRfc()
 {
     NameValueHeaderValue nameValue1 = new NameValueHeaderValue("text");
     NameValueHeaderValue nameValue2 = new NameValueHeaderValue("TEXT");
     Assert.Equal(nameValue1.GetHashCode(), nameValue2.GetHashCode());
 }
Пример #5
0
 public override int GetHashCode()
 {
     // The dispositionType string is case-insensitive.
     return(dispositionType.ToLowerInvariant().GetHashCode() ^ NameValueHeaderValue.GetHashCode(parameters));
 }
Пример #6
0
 /// <summary>充当 <see cref="T:System.Net.Http.Headers.ContentDispositionHeaderValue" /> 对象的哈希函数。</summary>
 /// <returns>当前对象的哈希代码。</returns>
 public override int GetHashCode()
 {
     return(StringComparer.OrdinalIgnoreCase.GetHashCode(this._dispositionType) ^ NameValueHeaderValue.GetHashCode(this._parameters));
 }