System.Globalization.CompareInfo.GetHashCodeOfString C# (CSharp) Method

GetHashCodeOfString() private method

private GetHashCodeOfString ( string source, CompareOptions options ) : int
source string
options CompareOptions
return int
        unsafe internal int GetHashCodeOfString(string source, CompareOptions options)
        {
            //
            //  Parameter validation
            //
            if(null == source) 
            {
                throw new ArgumentNullException("source");
            }

            if ((options & ValidHashCodeOfStringMaskOffFlags) != 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag"), "options"); 
            }

            if(0 == source.Length)
            {
                return(0);
            }

            //
            ////////////////////////////////////////////////////////////////////////


            return (nativeGetGlobalizedHashCode(m_pSortingTable, source, (int)options, this.m_sortingLCID));
        }
    

Usage Example

Beispiel #1
0
            public override int GetHashCode(string obj)
            {
                if (obj == null)
                {
                    throw new ArgumentNullException("obj");
                }
                Contract.EndContractBlock();

                CompareOptions options = CompareOptions.None;

                if (_ignoreCase)
                {
                    options |= CompareOptions.IgnoreCase;
                }

                return(_compareInfo.GetHashCodeOfString(obj, options));
            }