@@ -18,15 +18,15 @@ private Converter()
1818 {
1919 }
2020
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 ;
3030
3131 static Converter ( )
3232 {
@@ -151,8 +151,7 @@ internal static NewReference ToPython(object? value, Type type)
151151
152152 // it the type is a python subclass of a managed type then return the
153153 // 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 )
156155 {
157156 if ( ! IsTransparentProxy ( pyderived ) )
158157 return ClassDerivedObject . ToPython ( pyderived ) ;
@@ -161,7 +160,7 @@ internal static NewReference ToPython(object? value, Type type)
161160 // ModuleObjects are created in a way that their wrapping them as
162161 // a CLRObject fails, the ClassObject has no tpHandle. Return the
163162 // pyHandle as is, do not convert.
164- if ( value is ModuleObject modobj )
163+ if ( value is ModuleObject )
165164 {
166165 throw new NotImplementedException ( ) ;
167166 }
0 commit comments