Example #1
0
        /// <summary>
        /// Configures this instance.
        /// </summary>
        /// <param name="domain">A domain this validator is bound to.</param>
        /// <param name="type">A type this validator is bound to.</param>
        public virtual void Configure(Domain domain, TypeInfo type)
        {
            if (Domain != null)
            {
                throw Exceptions.AlreadyInitialized(null);
            }

            Domain = domain;
            Type   = type;
        }
        /// <summary>
        /// Initializes the list.
        /// This method should be invoked just once - before
        /// the first operation on this list.
        /// </summary>
        /// <param name="syncRoot"><see cref="SyncRoot"/> property value.</param>
        public void Initialize(object syncRoot)
        {
            if (implementation != null)
            {
                throw Exceptions.AlreadyInitialized(null);
            }
            this.SyncRoot = syncRoot;
            var tmp = new TItem[InitialSize];

            Thread.MemoryBarrier(); // Ensures tmp is fully written
            implementation = tmp;
        }