Ejemplo n.º 1
0
        internal static Type GetConverterType(MemberInfo memberInfo, out object[] converterParameters)
        {
            converterParameters = null;
            JsonCustomConverterAttribute att = memberInfo.GetCustomAttribute <JsonCustomConverterAttribute>(true);

            if (att == null)
            {
                return(null);
            }
            if (att.ConverterType == null)
            {
                throw new Exception($"{nameof(ConverterType)} must not be null in {nameof(JsonCustomConverterAttribute)} for member {memberInfo.Name} of type {memberInfo.ReflectedType}.");
            }
            converterParameters = att.GetParameters();
            return(att.ConverterType);
        }
Ejemplo n.º 2
0
        internal static Type GetConverterType(Type type, out object[] converterParameters)
        {
            converterParameters = null;
            JsonCustomConverterAttribute att = type.GetCustomAttribute <JsonCustomConverterAttribute>(true);

            if (att == null)
            {
                return(null);
            }
            if (att.ConverterType == null)
            {
                throw new Exception($"{nameof(ConverterType)} must not be null in {nameof(JsonCustomConverterAttribute)} for type {type.Name}.");
            }
            converterParameters = att.GetParameters();
            return(att.ConverterType);
        }