public void Add(string fieldName, FieldParseFunc parseHostField) { int index = GetFastHash(fieldName) % size; string lowerFieldName = fieldName.ToLower(); if (HashRows[index] == null) { HashRows[index] = new HashRow() { ParseFunc = parseHostField, Name = fieldName, Next = null }; } else { HashRow cur = HashRows[index]; while (cur.Next != null) { cur = cur.Next; } cur.Next = new HashRow() { Name = fieldName, Next = null, ParseFunc = parseHostField }; } }
public FuncHashTable(int size, FieldParseFunc defaultFunc) { HashRows = new HashRow[size]; this.size = size; this.defaultFunc = defaultFunc; }