System.Xml.NameTable.Add C# (CSharp) Méthode

Add() public méthode

public Add ( char key, int start, int len ) : string
key char
start int
len int
Résultat string
        public override string Add( char[] key, int start, int len ) {
            if ( len == 0 ) {
                return string.Empty;
            }

            int hashCode = len + hashCodeRandomizer;
            hashCode += ( hashCode << 7 ) ^ key[start];   // this will throw IndexOutOfRangeException in case the start index is invalid
            int end = start+len;
            for ( int i = start + 1; i < end; i++) {
                hashCode += ( hashCode << 7 ) ^ key[i];
            }
            // mix it a bit more
            hashCode -= hashCode >> 17; 
            hashCode -= hashCode >> 11; 
            hashCode -= hashCode >> 5;

            for ( Entry e = entries[hashCode & mask]; e != null; e = e.next ) {
                if ( e.hashCode == hashCode && TextEquals( e.str, key, start ) ) {
                    return e.str;
                }
            }
            return AddEntry( new string( key, start, len ), hashCode );
        }

Same methods

NameTable::Add ( string key ) : string

Usage Example

 private static XmlNameTable CreateNameTable()
 {
     XmlNameTable table = new System.Xml.NameTable();
     table.Add(string.Empty);
     table.Add("http://www.w3.org/2000/xmlns/");
     table.Add("http://www.w3.org/XML/1998/namespace");
     return table;
 }
All Usage Examples Of System.Xml.NameTable::Add