src/Shared/EntityFramework/Core/Metadata/Edm/ItemCollection.cs
/// <summary>Returns all the items of the specified type from this item collection.</summary>
/// <returns>
/// A collection of type <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> that contains all the items of the specified type.
/// </returns>
/// <typeparam name="T">The type returned by the method.</typeparam>
Returns all the items of the specified type from this item collection.
Returns all the items of the specified type from this item collection .
public virtual ReadOnlyCollection<T> GetItems<T>() where T : GlobalItem
        {
            var currentValueForItemCache = _itemsCache;
            if (_itemsCache == null
                || _itemCount != Count)
            {
                var itemsCache =
                    new Memoizer<Type, ICollection>(InternalGetItems, null);
                Interlocked.CompareExchange(ref _itemsCache, itemsCache, currentValueForItemCache);
                _itemCount = Count;
            }
            Debug.Assert(_itemsCache != null, "check the initialization of the Memoizer");
            var items = _itemsCache.Evaluate(typeof(T));
            var returnItems = items as ReadOnlyCollection<T>;
            return returnItems;
        }
public virtual ReadOnlyCollection < T > GetItems < T > ( ) where T : GlobalItem { var currentValueForItemCache = _itemsCache ; if ( _itemsCache == null || _itemCount != Count ) { var itemsCache = new Memoizer < Type , ICollection > ( InternalGetItems , null ) ; Interlocked . CompareExchange ( ref _itemsCache , itemsCache , currentValueForItemCache ) ; _itemCount = Count ; } Debug . Assert ( _itemsCache != null , " " ) ; var items = _itemsCache . Evaluate ( typeof ( T ) ) ; var returnItems = items as ReadOnlyCollection < T > ; return returnItems ; }
Returns all the items of the specified type from this item collection.
Returns all the items of the specified type from this item collection .
// initialize the memoizer, update the _itemCache and _itemCount // use memoizer so that it won't create a new list every time this method get called
A collection of type  that contains all the items of the specified type.
A collection of type that contains all the items of the specified type .
typeparam
The type returned by the method.
The type returned by the method .