示例#1
0
 /// <inheritdoc/>
 public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 {
     if (objectType == typeof(FontStyle))
     {
         return(FontStyle.Parse((string)reader.Value));
     }
     throw new ArgumentException("objectType");
 }
示例#2
0
        public void Parse_FontStyleFlags_String()
        {
            var target = FontStyle.Parse("Bold, Italic, Strikeout");

            Assert.Equal(
                FontStyleFlags.Bold
                | FontStyleFlags.Italic
                | FontStyleFlags.Strikeout, target.Flags);
        }
示例#3
0
 /// <inheritdoc/>
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     return(FontStyle.Parse((string)value));
 }