示例#1
0
 public static bool IsDerivedFrom <TParent>(this Type sourceType, TypeDerivedOptions derivedOptions = TypeDerivedOptions.Default)
 {
     return(TypeReflections.IsTypeDerivedFrom(sourceType, typeof(TParent), derivedOptions));
 }
示例#2
0
 public static bool IsDerivedFrom(this Type sourceType, Type parentType, TypeDerivedOptions derivedOptions = TypeDerivedOptions.Default)
 {
     return(TypeReflections.IsTypeDerivedFrom(sourceType, parentType, derivedOptions));
 }
示例#3
0
 public static bool IsObjectDerivedFrom <TSource>(TSource value, Type parentType, TypeIsOptions isOptions = TypeIsOptions.Default, TypeDerivedOptions derivedOptions = TypeDerivedOptions.Default)
 {
     if (parentType is null)
     {
         throw new ArgumentNullException(nameof(parentType));
     }
     return(isOptions switch
     {
         TypeIsOptions.Default => value is not null && IsTypeDerivedFrom(typeof(TSource), parentType, derivedOptions),
         TypeIsOptions.IgnoreNullable => IsTypeDerivedFrom(typeof(TSource), parentType, derivedOptions),
         _ => value is not null && IsTypeDerivedFrom(typeof(TSource), parentType, derivedOptions)
     });
示例#4
0
 public static bool IsTypeDerivedFrom <TSource, TParent>(TypeDerivedOptions derivedOptions = TypeDerivedOptions.Default) =>
 TypeReflections.IsTypeDerivedFrom <TSource, TParent>(derivedOptions);
示例#5
0
 public static bool IsTypeDerivedFrom(Type sourceType, Type parentType, TypeDerivedOptions derivedOptions = TypeDerivedOptions.Default) =>
 TypeReflections.IsTypeDerivedFrom(sourceType, parentType, derivedOptions);
示例#6
0
 public static bool IsObjectDerivedFrom <TSource>(TSource value, Type parentType, TypeIsOptions isOptions = TypeIsOptions.Default, TypeDerivedOptions derivedOptions = TypeDerivedOptions.Default) =>
 TypeReflections.IsObjectDerivedFrom(value, parentType, isOptions, derivedOptions);