/// <nodoc /> internal StringTable(int initialCapacity = 0) { Contract.Requires(initialCapacity >= 0); #if DebugStringTable DebugRegisterStringTable(this); #endif CaseInsensitiveEqualityComparer = new CaseInsensitiveStringIdEqualityComparer(this); CaseInsensitiveComparer = new CaseInsensitiveStringIdComparer(this); OrdinalComparer = new OrdinalStringIdComparer(this); m_stringSet = new ConcurrentBigSet <StringId>(capacity: initialCapacity); // set up the initial buffer and consume the first byte so that StringId.Invalid's slot is consumed m_byteBuffers[0] = new byte[BytesPerBuffer]; m_nextId = 1; Empty = AddString(string.Empty); }
/// <summary> /// Constructor used for deserialized tables /// </summary> protected StringTable(SerializedState state) { Contract.Requires(state != null); #if DebugStringTable DebugRegisterStringTable(this); #endif CaseInsensitiveEqualityComparer = new CaseInsensitiveStringIdEqualityComparer(this); CaseInsensitiveComparer = new CaseInsensitiveStringIdComparer(this); OrdinalComparer = new OrdinalStringIdComparer(this); m_byteBuffers = state.ByteBuffers; m_count = state.Count; m_nextId = state.NextId; m_stringSet = state.StringSet; Empty = AddString(string.Empty); }