コード例 #1
0
        public override object ReadJson(JsonReader reader, Type objectType, object?existingValue, JsonSerializer serializer)
        {
            var value = (string)reader.Value !;

            // ReSharper disable once HeapView.BoxingAllocation
            return(Base64Encoded.Decode(value));
        }
コード例 #2
0
 public override object ConvertFrom(ITypeDescriptorContext?context, CultureInfo?culture, object value)
 {
     if (value is string s)
     {
         // ReSharper disable once HeapView.BoxingAllocation
         return(Base64Encoded.Decode(s));
     }
     return(base.ConvertFrom(context, culture, value) !);
 }