private void ProcessConverter <T>(MemberInfo memberInfo, MemberMapping <T> memberMapping) { JsonConverterAttribute converterAttribute = memberInfo.GetCustomAttribute <JsonConverterAttribute>(); if (converterAttribute != null) { Type converterType = converterAttribute.ConverterType; memberMapping.SetConverter((JsonConverter)Activator.CreateInstance(converterType)); } }
private void ProcessConverter <T>(MemberInfo memberInfo, MemberMapping <T> memberMapping) { JsonConverterAttribute?converterAttribute = memberInfo.GetCustomAttribute <JsonConverterAttribute>(); if (converterAttribute != null) { Type converterType = converterAttribute.ConverterType; JsonConverter?converter = (JsonConverter?)Activator.CreateInstance(converterType); if (converter == null) { throw new JsonException($"Cannot instantiate {converterType}"); } memberMapping.SetConverter(converter); } }