예제 #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);
        }
예제 #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);
        }