コード例 #1
0
 /// <summary>
 /// Returns <see langword="true"/> if the specified type is constructable.
 /// </summary>
 /// <remarks>
 /// Constructable is defined as either having a default or implicit constructor or having a registered construction method.
 /// </remarks>
 /// <param name="type">The type to query.</param>
 /// <returns><see langword="true"/> if the given type is constructable.</returns>
 public static bool CanBeConstructed(Type type)
 {
     return(TypeConstructionCache.CanBeConstructed(type));
 }
コード例 #2
0
 /// <summary>
 /// Returns <see langword="true"/> if type <see cref="T"/> is constructable.
 /// </summary>
 /// <remarks>
 /// Constructable is defined as either having a default or implicit constructor or having a registered construction method.
 /// </remarks>
 /// <typeparam name="T">The type to query.</typeparam>
 /// <returns><see langword="true"/> if type <see cref="T"/> is constructable.</returns>
 public static bool CanBeConstructed <T>()
 {
     return(TypeConstructionCache.CanBeConstructed <T>());
 }
コード例 #3
0
 public static bool CanBeConstructedFromDerivedType <T>()
 {
     return(TypeConstructionCache <T> .ConstructibleTypes.Count >
            (TypeConstructionCache <T> .CanBeConstructed() ? 1 : 0));
 }