@@ -38,10 +38,10 @@ public static class DynamicClassFactory
38
38
private static readonly MethodInfo ObjectToString = typeof ( object ) . GetMethod ( "ToString" , BindingFlags . Instance | BindingFlags . Public , null , Type . EmptyTypes , null ) ! ;
39
39
#endif
40
40
41
- private static readonly ConstructorInfo StringBuilderCtor = typeof ( StringBuilder ) . GetConstructor ( Type . EmptyTypes ) ;
41
+ private static readonly ConstructorInfo StringBuilderCtor = typeof ( StringBuilder ) . GetConstructor ( Type . EmptyTypes ) ! ;
42
42
#if WINDOWS_APP || UAP10_0 || NETSTANDARD
43
- private static readonly MethodInfo StringBuilderAppendString = typeof ( StringBuilder ) . GetMethod ( "Append" , new [ ] { typeof ( string ) } ) ;
44
- private static readonly MethodInfo StringBuilderAppendObject = typeof ( StringBuilder ) . GetMethod ( "Append" , new [ ] { typeof ( object ) } ) ;
43
+ private static readonly MethodInfo StringBuilderAppendString = typeof ( StringBuilder ) . GetMethod ( "Append" , new [ ] { typeof ( string ) } ) ! ;
44
+ private static readonly MethodInfo StringBuilderAppendObject = typeof ( StringBuilder ) . GetMethod ( "Append" , new [ ] { typeof ( object ) } ) ! ;
45
45
#else
46
46
private static readonly MethodInfo StringBuilderAppendString = typeof ( StringBuilder ) . GetMethod ( "Append" , BindingFlags . Instance | BindingFlags . Public , null , new [ ] { typeof ( string ) } , null ) ! ;
47
47
private static readonly MethodInfo StringBuilderAppendObject = typeof ( StringBuilder ) . GetMethod ( "Append" , BindingFlags . Instance | BindingFlags . Public , null , new [ ] { typeof ( object ) } , null ) ! ;
@@ -441,6 +441,17 @@ public static Type CreateType(IList<DynamicProperty> properties, bool createPara
441
441
return type ;
442
442
}
443
443
444
+ /// <summary>
445
+ /// Used for unit-testing
446
+ /// </summary>
447
+ internal static void ClearGeneratedTypes ( )
448
+ {
449
+ lock ( GeneratedTypes )
450
+ {
451
+ GeneratedTypes . Clear ( ) ;
452
+ }
453
+ }
454
+
444
455
/// <summary>
445
456
/// Generates the key.
446
457
/// Anonymous classes are generics based. The generic classes are distinguished by number of parameters and name of parameters.
0 commit comments