@@ -18,15 +18,15 @@ private Converter()
18
18
{
19
19
}
20
20
21
- private static Type objectType ;
22
- private static Type stringType ;
23
- private static Type singleType ;
24
- private static Type doubleType ;
25
- private static Type int16Type ;
26
- private static Type int32Type ;
27
- private static Type int64Type ;
28
- private static Type boolType ;
29
- private static Type typeType ;
21
+ private static readonly Type objectType ;
22
+ private static readonly Type stringType ;
23
+ private static readonly Type singleType ;
24
+ private static readonly Type doubleType ;
25
+ private static readonly Type int16Type ;
26
+ private static readonly Type int32Type ;
27
+ private static readonly Type int64Type ;
28
+ private static readonly Type boolType ;
29
+ private static readonly Type typeType ;
30
30
31
31
static Converter ( )
32
32
{
@@ -151,8 +151,7 @@ internal static NewReference ToPython(object? value, Type type)
151
151
152
152
// it the type is a python subclass of a managed type then return the
153
153
// underlying python object rather than construct a new wrapper object.
154
- var pyderived = value as IPythonDerivedType ;
155
- if ( null != pyderived )
154
+ if ( value is IPythonDerivedType pyderived )
156
155
{
157
156
if ( ! IsTransparentProxy ( pyderived ) )
158
157
return ClassDerivedObject . ToPython ( pyderived ) ;
@@ -161,7 +160,7 @@ internal static NewReference ToPython(object? value, Type type)
161
160
// ModuleObjects are created in a way that their wrapping them as
162
161
// a CLRObject fails, the ClassObject has no tpHandle. Return the
163
162
// pyHandle as is, do not convert.
164
- if ( value is ModuleObject modobj )
163
+ if ( value is ModuleObject )
165
164
{
166
165
throw new NotImplementedException ( ) ;
167
166
}
0 commit comments