Unosquare
    Show / Hide Table of Contents

    Class TypeCache<T>

    A thread-safe cache of members belonging to a given type.

    The Retrieve method is the most useful one in this class as it calls the retrieval process if the type is not contained in the cache.

    Inheritance
    Object
    TypeCache<T>
    ConstructorTypeCache
    FieldTypeCache
    PropertyTypeCache
    Namespace: Swan.Reflection
    Syntax
    public abstract class TypeCache<T> : CollectionCacheRepository<T>
    Type Parameters
    Name Description
    T

    The type of Member to be cached.

    Methods

    Contains<TOut>()

    Determines whether the cache contains the specified type.

    Declaration
    public bool Contains<TOut>()
    Returns
    Type Description
    Boolean

    true if [contains]; otherwise, false.

    Type Parameters
    Name Description
    TOut

    The type of the out.

    Retrieve<TOut>(Func<Type, IEnumerable<T>>)

    Retrieves the properties stored for the specified type. If the properties are not available, it calls the factory method to retrieve them and returns them as an array of PropertyInfo.

    Declaration
    public IEnumerable<T> Retrieve<TOut>(Func<Type, IEnumerable<T>> factory)
    Parameters
    Type Name Description
    Func<Type, IEnumerable<T>> factory

    The factory.

    Returns
    Type Description
    IEnumerable<T>

    An array of the properties stored for the specified type.

    Type Parameters
    Name Description
    TOut

    The type of the out.

    Comments

    Back to top Copyright © 2017-2019 Unosquare