2222
2323using System ;
2424using System . Collections . Generic ;
25+ #if ! NETFX_35 && ! UNITY
2526using System . Diagnostics . Contracts ;
27+ #endif // !NETFX_35 && !UNITY
2628using System . Globalization ;
2729using System . Linq ;
2830using System . Reflection ;
@@ -44,72 +46,49 @@ partial class PolymorphismSchema
4446 /// ForPolymorphicObject( Type targetType )
4547 /// </summary>
4648 internal static readonly MethodInfo ForPolymorphicObjectTypeEmbeddingMethod =
47- FromExpression . ToMethod ( ( Type targetType ) => ForPolymorphicObject ( targetType ) ) ;
49+ typeof ( PolymorphismSchema ) . GetMethod ( "ForPolymorphicObject" , new [ ] { typeof ( Type ) } ) ;
4850
4951 /// <summary>
5052 /// ForPolymorphicObject( Type targetType, IDictionary{byte, Type} codeTypeMapping )
5153 /// </summary>
5254 internal static readonly MethodInfo ForPolymorphicObjectCodeTypeMappingMethod =
53- FromExpression . ToMethod (
54- ( Type targetType , IDictionary < byte , Type > codeTypeMapping ) => ForPolymorphicObject ( targetType , codeTypeMapping )
55- ) ;
55+ typeof ( PolymorphismSchema ) . GetMethod ( "ForPolymorphicObject" , new [ ] { typeof ( Type ) , typeof ( IDictionary < byte , Type > ) } ) ;
5656
5757 /// <summary>
5858 /// ForContextSpecifiedCollection( Type targetType, PolymorphismSchema itemsSchema )
5959 /// </summary>
6060 internal static readonly MethodInfo ForContextSpecifiedCollectionMethod =
61- FromExpression . ToMethod (
62- ( Type targetType , PolymorphismSchema itemsSchema ) => ForContextSpecifiedCollection ( targetType , itemsSchema )
63- ) ;
61+ typeof ( PolymorphismSchema ) . GetMethod ( "ForContextSpecifiedCollection" , new [ ] { typeof ( Type ) , typeof ( PolymorphismSchema ) } ) ;
6462
6563 /// <summary>
6664 /// ForPolymorphicCollection( Type targetType, PolymorphismSchema itemsSchema )
6765 /// </summary>
6866 internal static readonly MethodInfo ForPolymorphicCollectionTypeEmbeddingMethod =
69- FromExpression . ToMethod (
70- ( Type targetType , PolymorphismSchema itemsSchema ) => ForPolymorphicCollection ( targetType , itemsSchema )
71- ) ;
67+ typeof ( PolymorphismSchema ) . GetMethod ( "ForPolymorphicCollection" , new [ ] { typeof ( Type ) , typeof ( PolymorphismSchema ) } ) ;
7268
7369 /// <summary>
7470 /// ForPolymorphicCollection( Type targetType, IDictionary{byte, Type} codeTypeMapping, PolymorphismSchema itemsSchema )
7571 /// </summary>
7672 internal static readonly MethodInfo ForPolymorphicCollectionCodeTypeMappingMethod =
77- FromExpression . ToMethod (
78- ( Type targetType , IDictionary < byte , Type > codeTypeMapping , PolymorphismSchema itemsSchema ) =>
79- ForPolymorphicCollection ( targetType , codeTypeMapping , itemsSchema )
80- ) ;
73+ typeof ( PolymorphismSchema ) . GetMethod ( "ForPolymorphicCollection" , new [ ] { typeof ( Type ) , typeof ( IDictionary < byte , Type > ) , typeof ( PolymorphismSchema ) } ) ;
8174
8275 /// <summary>
8376 /// ForContextSpecifiedDictionary( Type targetType, PolymorphismSchema keysSchema, PolymorphismSchema valuesSchema )
8477 /// </summary>
8578 internal static readonly MethodInfo ForContextSpecifiedDictionaryMethod =
86- FromExpression . ToMethod (
87- ( Type targetType , PolymorphismSchema keysSchema , PolymorphismSchema valuesSchema ) =>
88- ForContextSpecifiedDictionary ( targetType , keysSchema , valuesSchema )
89- ) ;
79+ typeof ( PolymorphismSchema ) . GetMethod ( "ForContextSpecifiedDictionary" , new [ ] { typeof ( Type ) , typeof ( PolymorphismSchema ) , typeof ( PolymorphismSchema ) } ) ;
9080
9181 /// <summary>
9282 /// ForPolymorphicDictionary( Type targetType, PolymorphismSchema keysSchema, PolymorphismSchema valuesSchema )
9383 /// </summary>
9484 internal static readonly MethodInfo ForPolymorphicDictionaryTypeEmbeddingMethod =
95- FromExpression . ToMethod (
96- ( Type targetType , PolymorphismSchema keysSchema , PolymorphismSchema valuesSchema ) =>
97- ForPolymorphicDictionary ( targetType , keysSchema , valuesSchema )
98- ) ;
85+ typeof ( PolymorphismSchema ) . GetMethod ( "ForPolymorphicDictionary" , new [ ] { typeof ( Type ) , typeof ( PolymorphismSchema ) , typeof ( PolymorphismSchema ) } ) ;
9986
10087 /// <summary>
10188 /// ForPolymorphicDictionary( Type targetType, IDictionary{byte, Type} codeTypeMapping, PolymorphismSchema keysSchema, PolymorphismSchema valuesSchema )
10289 /// </summary>
10390 internal static readonly MethodInfo ForPolymorphicDictionaryCodeTypeMappingMethod =
104- FromExpression . ToMethod (
105- ( Type targetType ,
106- IDictionary < byte , Type > codeTypeMapping ,
107- PolymorphismSchema keysSchema ,
108- PolymorphismSchema valuesSchema
109- ) =>
110- ForPolymorphicDictionary ( targetType , codeTypeMapping , keysSchema , valuesSchema )
111- ) ;
112-
91+ typeof ( PolymorphismSchema ) . GetMethod ( "ForPolymorphicDictionary" , new [ ] { typeof ( Type ) , typeof ( IDictionary < byte , Type > ) , typeof ( PolymorphismSchema ) , typeof ( PolymorphismSchema ) } ) ;
11392
11493#if ! WINDOWS_PHONE && ! NETFX_35 && ! UNITY
11594 /// <summary>
@@ -123,7 +102,7 @@ PolymorphismSchema valuesSchema
123102
124103 internal static readonly ConstructorInfo CodeTypeMapConstructor =
125104 typeof ( Dictionary < , > ) . MakeGenericType ( typeof ( byte ) , typeof ( Type ) )
126- . GetConstructor ( new [ ] { typeof ( int ) } ) ;
105+ . GetConstructor ( new [ ] { typeof ( int ) } ) ;
127106
128107 internal static readonly MethodInfo AddToCodeTypeMapMethod =
129108 typeof ( Dictionary < , > ) . MakeGenericType ( typeof ( byte ) , typeof ( Type ) )
@@ -223,7 +202,7 @@ internal static PolymorphismSchema Create(
223202#if ! UNITY
224203 SerializingMember ? memberMayBeNull
225204#else
226- SerializingMember memberMayBeNull
205+ SerializingMember memberMayBeNull
227206#endif // !UNITY
228207 )
229208 {
@@ -278,7 +257,7 @@ SerializingMember memberMayBeNull
278257 return Default ;
279258 }
280259
281- return
260+ return
282261 new PolymorphismSchema (
283262 member . Member . GetMemberValueType ( ) ,
284263 table . Member . PolymorphismType ,
@@ -352,19 +331,25 @@ private struct TypeTable
352331 public readonly TypeTableEntry Member ;
353332 public readonly TypeTableEntry CollectionItem ;
354333 public readonly TypeTableEntry DictionaryKey ;
334+ #if ! WINDOWS_PHONE && ! NETFX_35 && ! UNITY
355335 public readonly IList < TypeTableEntry > TupleItems ;
336+ #endif // !WINDOWS_PHONE && !NETFX_35 && !UNITY
356337
357338 private TypeTable (
358339 TypeTableEntry member ,
359340 TypeTableEntry collectionItem ,
360- TypeTableEntry dictionaryKey ,
361- IList < TypeTableEntry > tupleItems
341+ TypeTableEntry dictionaryKey
342+ #if ! WINDOWS_PHONE && ! NETFX_35 && ! UNITY
343+ , IList< TypeTableEntry> tupleItems
344+ #endif // !WINDOWS_PHONE && !NETFX_35 && !UNITY
362345 )
363346 {
364347 this . Member = member ;
365348 this . CollectionItem = collectionItem ;
366349 this . DictionaryKey = dictionaryKey ;
350+ #if ! WINDOWS_PHONE && ! NETFX_35 && ! UNITY
367351 this . TupleItems = tupleItems ;
352+ #endif // !WINDOWS_PHONE && !NETFX_35 && !UNITY
368353 }
369354
370355 public static TypeTable Create ( SerializationContext context , MemberInfo member )
@@ -373,15 +358,19 @@ public static TypeTable Create( SerializationContext context, MemberInfo member
373358 new TypeTable (
374359 TypeTableEntry . Create ( context , member , PolymorphismTarget . Member ) ,
375360 TypeTableEntry . Create ( context , member , PolymorphismTarget . CollectionItem ) ,
376- TypeTableEntry . Create ( context , member , PolymorphismTarget . DictionaryKey ) ,
377- TypeTableEntry . CreateTupleItems ( context , member )
361+ TypeTableEntry . Create ( context , member , PolymorphismTarget . DictionaryKey )
362+ #if ! WINDOWS_PHONE && ! NETFX_35 && ! UNITY
363+ , TypeTableEntry . CreateTupleItems ( context , member )
364+ #endif // !WINDOWS_PHONE && !NETFX_35 && !UNITY
378365 ) ;
379366 }
380367 }
381368
382369 private sealed class TypeTableEntry
383370 {
371+ #if ! WINDOWS_PHONE && ! NETFX_35 && ! UNITY
384372 private static readonly TypeTableEntry [ ] EmptyEntries = new TypeTableEntry [ 0 ] ;
373+ #endif // !WINDOWS_PHONE && !NETFX_35 && !UNITY
385374
386375 private readonly Dictionary < byte , Type > _knownTypeMapping = new Dictionary < byte , Type > ( ) ;
387376
@@ -422,6 +411,7 @@ var attribute in
422411 return result ;
423412 }
424413
414+ #if ! WINDOWS_PHONE && ! NETFX_35 && ! UNITY
425415 public static TypeTableEntry [ ] CreateTupleItems ( SerializationContext context , MemberInfo member )
426416 {
427417 if ( ! TupleItems . IsTuple ( member . GetMemberValueType ( ) ) )
@@ -443,6 +433,7 @@ var attribute in
443433
444434 return result ;
445435 }
436+ #endif // !WINDOWS_PHONE && !NETFX_35 && !UNITY
446437
447438 private void Interpret ( SerializationContext context , IPolymorphicHelperAttribute attribute , string memberName , int tupleItemNumber )
448439 {
@@ -470,14 +461,14 @@ private void Interpret( SerializationContext context, IPolymorphicHelperAttribut
470461 }
471462 }
472463
473- #if DEBUG && ! UNITY
464+ #if DEBUG && ! NETFX_35 && ! UNITY
474465 Contract . Assert ( attribute is IPolymorphicRuntimeTypeAttribute , attribute + " is IPolymorphicRuntimeTypeAttribute" ) ;
475- #endif // DEBUG && !UNITY
466+ #endif // DEBUG && !NETFX_35 && ! UNITY
476467 if ( this . _useTypeEmbedding )
477468 {
478- #if DEBUG && ! UNITY
469+ #if DEBUG && ! NETFX_35 && ! UNITY
479470 Contract . Assert ( attribute . Target == PolymorphismTarget . TupleItem , attribute . Target + " == PolymorphismTarget.TupleItem" ) ;
480- #endif // DEBUG && !UNITY
471+ #endif // DEBUG && !NETFX_35 && ! UNITY
481472 throw new SerializationException (
482473 String . Format (
483474 CultureInfo . CurrentCulture ,
0 commit comments