Exemple #1
0
            /// <summary>
            /// 从引用池获取引用
            /// </summary>
            /// <typeparam name="T">引用类型。</typeparam>
            /// <returns>引用。</returns>
            public static T Take <T>()
                where T : class, IReference, new()
            {
                System.Type         referenceType       = typeof(T);
                ReferenceCollection referenceCollection = GetReferenceCollection(referenceType);

                if (referenceCollection == null)
                {
                    CreateReferenceCollection(referenceType);
                    referenceCollection = GetReferenceCollection(referenceType);
                }
                return(referenceCollection.Take <T>());
            }