@@ -82,6 +82,22 @@ public static object Deserialize(Type type, ReadOnlySequence<byte> bytes, Messag
8282 return GetOrAdd ( type ) . Deserialize_ReadOnlySequence_Options_CancellationToken . Invoke ( bytes , options , cancellationToken ) ;
8383 }
8484
85+ /// <summary>
86+ /// Helper method used by reflection.
87+ /// </summary>
88+ private static void SerializeSemiGeneric < T > ( ref MessagePackWriter writer , object valueObject , MessagePackSerializerOptions options = null )
89+ {
90+ Serialize ( ref writer , ( T ) valueObject , options ) ;
91+ }
92+
93+ /// <summary>
94+ /// Helper method used by reflection.
95+ /// </summary>
96+ private static object DeserializeSemiGeneric < T > ( ref MessagePackReader reader , MessagePackSerializerOptions options = null )
97+ {
98+ return Deserialize < T > ( ref reader , options ) ;
99+ }
100+
85101 private static async ValueTask < object > DeserializeObjectAsync < T > ( Stream stream , MessagePackSerializerOptions options , CancellationToken cancellationToken ) => await DeserializeAsync < T > ( stream , options , cancellationToken ) . ConfigureAwait ( false ) ;
86102
87103 private static CompiledMethods GetOrAdd ( Type type )
@@ -219,8 +235,8 @@ internal CompiledMethods(Type type)
219235 }
220236
221237 {
222- // public static void Serialize <T>(ref MessagePackWriter writer, T obj, MessagePackSerializerOptions options)
223- MethodInfo serialize = GetMethod ( nameof ( SerializeSemiGeneric ) , type , new Type [ ] { typeof ( MessagePackWriter ) . MakeByRefType ( ) , typeof ( Object ) , typeof ( MessagePackSerializerOptions ) } ) ;
238+ // private static void SerializeSemiGeneric <T>(ref MessagePackWriter writer, object obj, MessagePackSerializerOptions options)
239+ MethodInfo serialize = GetMethod ( nameof ( SerializeSemiGeneric ) , type , new Type [ ] { typeof ( MessagePackWriter ) . MakeByRefType ( ) , typeof ( object ) , typeof ( MessagePackSerializerOptions ) } ) ;
224240#if ENABLE_IL2CPP
225241 this . Serialize_MessagePackWriter_T_Options = ( ref MessagePackWriter x , object y , MessagePackSerializerOptions z ) => ThrowRefStructNotSupported ( ) ;
226242#else
@@ -229,7 +245,7 @@ internal CompiledMethods(Type type)
229245 }
230246
231247 {
232- // public static T Deserialize <T>(ref MessagePackReader reader, MessagePackSerializerOptions options)
248+ // private static object DeserializeSemiGeneric <T>(ref MessagePackReader reader, MessagePackSerializerOptions options)
233249 MethodInfo deserialize = GetMethod ( nameof ( DeserializeSemiGeneric ) , type , new Type [ ] { typeof ( MessagePackReader ) . MakeByRefType ( ) , typeof ( MessagePackSerializerOptions ) } ) ;
234250#if ENABLE_IL2CPP
235251 this . Deserialize_MessagePackReader_Options = ( ref MessagePackReader reader , MessagePackSerializerOptions options ) => { ThrowRefStructNotSupported ( ) ; return null ; } ;
0 commit comments