@@ -25,7 +25,7 @@ public partial class PreserializedResourceWriter
25
25
// an internal type name used to represent an unknown resource type, explicitly omit version to save
26
26
// on size and avoid changes in user resources. This works since we only ever load this type name
27
27
// from calls to GetType from this assembly.
28
- private static readonly string UnknownObjectTypeName = typeof ( UnknownType ) . FullName ;
28
+ private static readonly string UnknownObjectTypeName = typeof ( UnknownType ) . FullName ! ;
29
29
30
30
private string ResourceReaderTypeName => _requiresDeserializingResourceReader ?
31
31
DeserializingResourceReaderFullyQualifiedName :
@@ -40,22 +40,22 @@ public partial class PreserializedResourceWriter
40
40
// is done by reflection
41
41
private static readonly IReadOnlyDictionary < string , Type > s_primitiveTypes = new Dictionary < string , Type > ( 16 , TypeNameComparer . Instance )
42
42
{
43
- { typeof ( string ) . FullName , typeof ( string ) } ,
44
- { typeof ( int ) . FullName , typeof ( int ) } ,
45
- { typeof ( bool ) . FullName , typeof ( bool ) } ,
46
- { typeof ( char ) . FullName , typeof ( char ) } ,
47
- { typeof ( byte ) . FullName , typeof ( byte ) } ,
48
- { typeof ( sbyte ) . FullName , typeof ( sbyte ) } ,
49
- { typeof ( short ) . FullName , typeof ( short ) } ,
50
- { typeof ( long ) . FullName , typeof ( long ) } ,
51
- { typeof ( ushort ) . FullName , typeof ( ushort ) } ,
52
- { typeof ( uint ) . FullName , typeof ( uint ) } ,
53
- { typeof ( ulong ) . FullName , typeof ( ulong ) } ,
54
- { typeof ( float ) . FullName , typeof ( float ) } ,
55
- { typeof ( double ) . FullName , typeof ( double ) } ,
56
- { typeof ( decimal ) . FullName , typeof ( decimal ) } ,
57
- { typeof ( DateTime ) . FullName , typeof ( DateTime ) } ,
58
- { typeof ( TimeSpan ) . FullName , typeof ( TimeSpan ) }
43
+ { typeof ( string ) . FullName ! , typeof ( string ) } ,
44
+ { typeof ( int ) . FullName ! , typeof ( int ) } ,
45
+ { typeof ( bool ) . FullName ! , typeof ( bool ) } ,
46
+ { typeof ( char ) . FullName ! , typeof ( char ) } ,
47
+ { typeof ( byte ) . FullName ! , typeof ( byte ) } ,
48
+ { typeof ( sbyte ) . FullName ! , typeof ( sbyte ) } ,
49
+ { typeof ( short ) . FullName ! , typeof ( short ) } ,
50
+ { typeof ( long ) . FullName ! , typeof ( long ) } ,
51
+ { typeof ( ushort ) . FullName ! , typeof ( ushort ) } ,
52
+ { typeof ( uint ) . FullName ! , typeof ( uint ) } ,
53
+ { typeof ( ulong ) . FullName ! , typeof ( ulong ) } ,
54
+ { typeof ( float ) . FullName ! , typeof ( float ) } ,
55
+ { typeof ( double ) . FullName ! , typeof ( double ) } ,
56
+ { typeof ( decimal ) . FullName ! , typeof ( decimal ) } ,
57
+ { typeof ( DateTime ) . FullName ! , typeof ( DateTime ) } ,
58
+ { typeof ( TimeSpan ) . FullName ! , typeof ( TimeSpan ) }
59
59
// byte[] and Stream are primitive types but do not define a conversion from string
60
60
} ;
61
61
@@ -80,7 +80,7 @@ public void AddResource(string name, string value, string typeName)
80
80
throw new ArgumentNullException ( nameof ( typeName ) ) ;
81
81
82
82
// determine if the type is a primitive type
83
- if ( s_primitiveTypes . TryGetValue ( typeName , out Type primitiveType ) )
83
+ if ( s_primitiveTypes . TryGetValue ( typeName , out Type ? primitiveType ) )
84
84
{
85
85
// directly add strings
86
86
if ( primitiveType == typeof ( string ) )
0 commit comments