public uint Add(T value) { for (int i = 0; i < this.fastSegment.Length; ++i) { if (this.fastSegment[i] == null) { this.fastSegment[i] = value; return((uint)i); } } if (this.slowSegment == null) { this.slowSegment = new Dictionary <uint, T>(); } uint handle = (uint)this.fastSegment.Length; while (handle < this.maxHandle && this.slowSegment.ContainsKey(handle)) { ++handle; } if (handle == this.maxHandle) { throw new AmqpException(AmqpError.ResourceLimitExceeded, SRClient.AmqpHandleExceeded(this.maxHandle)); } this.slowSegment.Add(handle, value); return(handle); }