コード例 #1
0
 private void InitializeCommonForgePairs()
 {
     _forgePairs[typeof(IDictionary <string, object>)] = new JsonSerializationForgePair(
         new JsonSerializerForgeByMethod("WriteJsonMap"),
         new JsonDeserializerForgeByClass(typeof(JsonDeserializerGenericObject)));
     _forgePairs[typeof(object[])] = new JsonSerializationForgePair(
         new JsonSerializerForgeByMethod("WriteJsonArray"),
         new JsonDeserializerForgeByClass(typeof(JsonDeserializerGenericArray)));
     _forgePairs[typeof(object)] = new JsonSerializationForgePair(
         new JsonSerializerForgeByMethod("WriteJsonValue"),
         new JsonDeserializerForgeByClass(typeof(JsonDeserializerGenericObject)));
 }
コード例 #2
0
 private void InitializeBuiltinForgePairs()
 {
     _forgePairs[typeof(string)] = new JsonSerializationForgePair(
         JsonSerializerForgeString.INSTANCE,
         JsonDeserializerForgeString.INSTANCE);
     _forgePairs[typeof(char?)] = new JsonSerializationForgePair(
         JsonSerializerForgeStringWithToString.INSTANCE,
         JsonDeserializerForgeCharacter.INSTANCE);
     _forgePairs[typeof(bool?)] = new JsonSerializationForgePair(
         JsonSerializerForgeBoolean.INSTANCE,
         JsonDeserializerForgeBoolean.INSTANCE);
     _forgePairs[typeof(byte?)] = new JsonSerializationForgePair(
         JsonSerializerForgeNumber.INSTANCE,
         JsonDeserializerForgeByte.INSTANCE);
     _forgePairs[typeof(short?)] = new JsonSerializationForgePair(
         JsonSerializerForgeNumber.INSTANCE,
         JsonDeserializerForgeInt16.INSTANCE);
     _forgePairs[typeof(int?)] = new JsonSerializationForgePair(
         JsonSerializerForgeNumber.INSTANCE,
         JsonDeserializerForgeInt32.INSTANCE);
     _forgePairs[typeof(long?)] = new JsonSerializationForgePair(
         JsonSerializerForgeNumber.INSTANCE,
         JsonDeserializerForgeInt64.INSTANCE);
     _forgePairs[typeof(float?)] = new JsonSerializationForgePair(
         JsonSerializerForgeNumber.INSTANCE,
         JsonDeserializerForgeSingle.INSTANCE);
     _forgePairs[typeof(double?)] = new JsonSerializationForgePair(
         JsonSerializerForgeNumber.INSTANCE,
         JsonDeserializerForgeDouble.INSTANCE);
     _forgePairs[typeof(decimal?)] = new JsonSerializationForgePair(
         JsonSerializerForgeNumber.INSTANCE,
         JsonDeserializerForgeDecimal.INSTANCE);
     _forgePairs[typeof(BigInteger?)] = new JsonSerializationForgePair(
         JsonSerializerForgeNumber.INSTANCE,
         JsonDeserializerForgeBigInteger.INSTANCE);
     _forgePairs[typeof(Guid)] = new JsonSerializationForgePair(
         JsonSerializerForgeStringWithToString.INSTANCE,
         JsonDeserializerForgeUuid.INSTANCE);
     _forgePairs[typeof(DateTimeEx)] = new JsonSerializationForgePair(
         JsonSerializerForgeStringWithToString.INSTANCE,
         JsonDeserializerForgeDateTimeEx.INSTANCE);
     _forgePairs[typeof(DateTimeOffset)] = new JsonSerializationForgePair(
         JsonSerializerForgeStringWithToString.INSTANCE,
         JsonDeserializerForgeDateTimeOffset.INSTANCE);
     _forgePairs[typeof(DateTime)] = new JsonSerializationForgePair(
         JsonSerializerForgeStringWithToString.INSTANCE,
         JsonDeserializerForgeDateTime.INSTANCE);
     _forgePairs[typeof(Uri)] = new JsonSerializationForgePair(
         JsonSerializerForgeStringWithToString.INSTANCE,
         JsonDeserializerForgeUri.INSTANCE);
 }