YamlDotNet.ReflectionExtensions.HasDefaultConstructor C# (CSharp) Method

HasDefaultConstructor() public static method

Determines whether the specified type has a default constructor.
public static HasDefaultConstructor ( this type ) : bool
type this The type.
return bool
        public static bool HasDefaultConstructor(this Type type)
        {
            var typeInfo = type.GetTypeInfo();
            return typeInfo.IsValueType || typeInfo.DeclaredConstructors
                .Any(c => c.IsPublic && !c.IsStatic && c.GetParameters().Length == 0);
        }