UtilJsonApiSerializer.Conventions.Impl.DefaultPropertyScanningConvention.IsMarkedSerializeAsPrimitive C# (CSharp) Method

IsMarkedSerializeAsPrimitive() private method

Looks for "SerializeAsPrimitive" using reflection, with the idea being that such an attribute may be re-defined in projects that don't reference this one
private IsMarkedSerializeAsPrimitive ( PropertyInfo pi ) : bool
pi System.Reflection.PropertyInfo
return bool
        private bool IsMarkedSerializeAsPrimitive(PropertyInfo pi)
        {
            if(Attribute.IsDefined(pi, typeof(SerializeAsPrimitive))) return true;

            var attrs = pi.GetCustomAttributes(true).ToDictionary(a => a.GetType().Name, a => a);
            foreach(string name in attrs.Keys)
            {
                if(name.ToLower().Contains("serializeasprimitive")) return true;
            }
            return false;
        }