コード例 #1
0
        public override int GetHashCode(string obj)
        {
            Split(obj, out string section, out string scope, out string property);

            int code = OrdinalIgnoreCase.GetHashCode(section) ^
                       OrdinalIgnoreCase.GetHashCode(property);

            return(scope is null
                ? code
                : code ^ Ordinal.GetHashCode(scope));
        }
コード例 #2
0
        public void TestHashCode()
        {
            for (var i = 0; i < _allStrings.Length; i++)
            {
                var str = _allStrings[i];
                int hc  = StringComparer.OrdinalIgnoreCase.GetHashCode(str);
                int hc2 = OrdinalIgnoreCase.GetHashCode(str);
                if (hc != hc2)
                {
                    var points = _allPoints[i];

                    for (int j = 0; j < points.Length; j++)
                    {
                        UnicodeEntry cd   = _loader[points[j]];
                        string       str2 = cd.ToString();
                        hc  = StringComparer.OrdinalIgnoreCase.GetHashCode(str2);
                        hc2 = OrdinalIgnoreCase.GetHashCode(str2);
                        if (hc != hc2)
                        {
                            if (cd.Uppercase != 0)
                            {
                                var cd2  = _loader[cd.Uppercase];
                                var str3 = cd2.ToString();
                                int hc3  = StringComparer.OrdinalIgnoreCase.GetHashCode(str3);
                                //int hc4 = MapUtil.GetCaseInsensitiveHashCode( str3 );
                                if (string.Equals(str2, str3, StringComparison.OrdinalIgnoreCase))
                                {
                                    Debug.WriteLine("'{0}'", str2);
                                }

                                if (hc3 == hc)
                                {
                                    Debug.WriteLine("'{0}' != '{1}' (U+{2:X6}) != U+{3:X6})" +
                                                    "(U+{4:X4},{5:X4}) != U+{6:X4},{7:X4})",
                                                    str2, str3, cd.CodeValue, cd2.CodeValue,
                                                    (int)str2[0], (int)str2[1], (int)str3[0], (int)str3[1]);
                                }
                            }
                            else
                            {
                                Debug.WriteLine("'{0}'", str2);
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
 private static int CalculateHashCode(string obj)
 {
     return(OrdinalIgnoreCase.GetHashCode(NormalizePathString(obj)));
 }
コード例 #4
0
 /// <inheritdoc />
 public override int GetHashCode(string obj)
 {
     return(OrdinalIgnoreCase.GetHashCode(obj));
 }
コード例 #5
0
 public void Tuple()
 {
     _ = (type, StringComparer.OrdinalIgnoreCase.GetHashCode(text)).GetHashCode();
 }
コード例 #6
0
ファイル: SqlIdentifier.cs プロジェクト: xavierjohn/More.Cqrs
 /// <summary>
 /// Returns a hash code for the current instance.
 /// </summary>
 /// <returns>A hash code.</returns>
 public override int GetHashCode()
 {
     return((OrdinalIgnoreCase.GetHashCode(SchemaName) * 397) ^ OrdinalIgnoreCase.GetHashCode(ObjectName));
 }