@@ -861,7 +861,7 @@ public static Func<T, string> RawSerializeFn
861861 public static Func < T , T > OnSerializingFn
862862 {
863863 get { return onSerializingFn ; }
864- set { onSerializingFn = value ; }
864+ set { onSerializingFn = value ; Refresh ( ) ; }
865865 }
866866
867867 /// <summary>
@@ -871,18 +871,28 @@ public static Func<T, T> OnSerializingFn
871871 public static Action < T > OnSerializedFn
872872 {
873873 get { return onSerializedFn ; }
874- set { onSerializedFn = value ; }
874+ set { onSerializedFn = value ; Refresh ( ) ; }
875875 }
876876
877877 /// <summary>
878878 /// Define custom deserialization fn for BCL Structs
879879 /// </summary>
880- public static Func < string , T > DeSerializeFn ;
880+ private static Func < string , T > deSerializeFn ;
881+ public static Func < string , T > DeSerializeFn
882+ {
883+ get { return deSerializeFn ; }
884+ set { deSerializeFn = value ; Refresh ( ) ; }
885+ }
881886
882887 /// <summary>
883888 /// Define custom raw deserialization fn for objects
884889 /// </summary>
885- public static Func < string , T > RawDeserializeFn ;
890+ private static Func < string , T > rawDeserializeFn ;
891+ public static Func < string , T > RawDeserializeFn
892+ {
893+ get { return rawDeserializeFn ; }
894+ set { rawDeserializeFn = value ; Refresh ( ) ; }
895+ }
886896
887897 public static bool HasDeserializeFn
888898 {
@@ -893,7 +903,7 @@ public static bool HasDeserializeFn
893903 public static Func < T , T > OnDeserializedFn
894904 {
895905 get { return onDeserializedFn ; }
896- set { onDeserializedFn = value ; }
906+ set { onDeserializedFn = value ; Refresh ( ) ; }
897907 }
898908
899909 public static bool HasDeserialingFn
@@ -905,7 +915,7 @@ public static bool HasDeserialingFn
905915 public static Func < T , string , object , object > OnDeserializingFn
906916 {
907917 get { return onDeserializingFn ; }
908- set { onDeserializingFn = value ; }
918+ set { onDeserializingFn = value ; Refresh ( ) ; }
909919 }
910920
911921 /// <summary>
@@ -987,8 +997,8 @@ internal static object ParseFn(ITypeSerializer serializer, string str)
987997
988998 internal static void ClearFnCaches ( )
989999 {
990- typeof ( JsonWriter < > ) . MakeGenericType ( new [ ] { typeof ( T ) } ) . InvokeReset ( ) ;
991- typeof ( JsvWriter < > ) . MakeGenericType ( new [ ] { typeof ( T ) } ) . InvokeReset ( ) ;
1000+ JsonWriter < T > . Reset ( ) ;
1001+ JsvWriter < T > . Reset ( ) ;
9921002 }
9931003
9941004 public static void Reset ( )
@@ -998,6 +1008,14 @@ public static void Reset()
9981008 ExcludePropertyNames = null ;
9991009 EmitCamelCaseNames = EmitLowercaseUnderscoreNames = IncludeTypeInfo = ExcludeTypeInfo = null ;
10001010 }
1011+
1012+ public static void Refresh ( )
1013+ {
1014+ JsonReader < T > . Refresh ( ) ;
1015+ JsonWriter < T > . Refresh ( ) ;
1016+ JsvReader < T > . Refresh ( ) ;
1017+ JsvWriter < T > . Refresh ( ) ;
1018+ }
10011019 }
10021020
10031021 public enum PropertyConvention
0 commit comments