コード例 #1
0
 protected override void ExportValue(ExportContext context, object value, JsonWriter writer)
 {
     string str;
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     try
     {
         str = this.ConvertToString(value);
     }
     catch (InvalidCastException exception)
     {
         throw new JsonException(exception.Message, exception);
     }
     writer.WriteNumber(str);
 }
コード例 #2
0
 protected override void ExportValue(ExportContext context, object value, JsonWriter writer)
 {
     writer.WriteNumber(((JsonNumber) value).ToString());
 }