Exemplo n.º 1
0
 /// <summary>
 ///     Determines whether the type is definitely unsupported for schema generation.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <returns>
 ///     <c>true</c> if the type is unsupported; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsUnsupported(this Type type)
 => type == typeof(IntPtr) ||
 type == typeof(UIntPtr) ||
 type == typeof(object) ||
 type.GetTypeInfo().ContainsGenericParameters ||
 (!type.IsArray &&
  !type.GetTypeInfo().IsValueType &&
  !type.HasSupportedParameterizedConstructor() &&
  !type.HasParameterlessConstructor() &&
  type != typeof(string) &&
  type != typeof(Uri) &&
  !type.GetTypeInfo().IsAbstract &&
  !type.GetTypeInfo().IsInterface &&
  !(type.GetTypeInfo().IsGenericType&& SupportedInterfaces.Contains(type.GetGenericTypeDefinition())));
Exemplo n.º 2
0
 /// <summary>
 ///     Determines whether the type is definitely unsupported for schema generation.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <returns>
 ///     <c>true</c> if the type is unsupported; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsUnsupported(this Type type)
 {
     return(type == typeof(IntPtr) ||
            type == typeof(UIntPtr) ||
            type == typeof(object) ||
            type.ContainsGenericParameters() ||
            (!type.IsArray &&
             !type.IsValueType() &&
             !type.IsAnonymous() &&
             !type.HasParameterlessConstructor() &&
             type != typeof(string) &&
             type != typeof(Uri) &&
             !type.IsAbstract() &&
             !type.IsInterface() &&
             !(type.IsGenericType() && SupportedInterfaces.Contains(type.GetGenericTypeDefinition()))));
 }