System.Xml.Serialization.TypeScope.GetConstructorFlags C# (CSharp) Method

GetConstructorFlags() private static method

private static GetConstructorFlags ( Type type, Exception &exception ) : TypeFlags
type System.Type
exception System.Exception
return TypeFlags
        private static TypeFlags GetConstructorFlags(Type type, ref Exception exception)
        {
            ConstructorInfo ctor = type.GetConstructor(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic, Array.Empty<Type>());
            if (ctor != null)
            {
                TypeFlags flags = TypeFlags.HasDefaultConstructor;
                if (!ctor.IsPublic)
                    flags |= TypeFlags.CtorInaccessible;
                else
                {
                    object[] attrs = ctor.GetCustomAttributes(typeof(ObsoleteAttribute), false);
                    if (attrs != null && attrs.Length > 0)
                    {
                        ObsoleteAttribute obsolete = (ObsoleteAttribute)attrs[0];
                        if (obsolete.IsError)
                        {
                            flags |= TypeFlags.CtorInaccessible;
                        }
                    }
                }
                return flags;
            }
            return 0;
        }