/// <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"); }
public void Parse_FontStyleFlags_String() { var target = FontStyle.Parse("Bold, Italic, Strikeout"); Assert.Equal( FontStyleFlags.Bold | FontStyleFlags.Italic | FontStyleFlags.Strikeout, target.Flags); }
/// <inheritdoc/> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { return(FontStyle.Parse((string)value)); }