@@ -16,11 +16,11 @@ public DescribableEnumConverter(Type type) : base(type)
16
16
enumType = type ;
17
17
}
18
18
19
- public override bool CanConvertFrom ( ITypeDescriptorContext context , Type srcType ) => srcType == typeof ( string ) ;
19
+ public override bool CanConvertFrom ( ITypeDescriptorContext ? context , Type srcType ) => srcType == typeof ( string ) ;
20
20
21
- public override bool CanConvertTo ( ITypeDescriptorContext context , Type destType ) => destType == typeof ( string ) ;
21
+ public override bool CanConvertTo ( ITypeDescriptorContext ? context , Type ? destType ) => destType == typeof ( string ) ;
22
22
23
- public override object ConvertFrom ( ITypeDescriptorContext context , CultureInfo culture , object value )
23
+ public override object ConvertFrom ( ITypeDescriptorContext ? context , CultureInfo ? culture , object value )
24
24
{
25
25
var valueStr = value ? . ToString ( ) ?? throw new ArgumentNullException ( paramName : nameof ( value ) ) ;
26
26
return Enum . Parse (
@@ -31,7 +31,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c
31
31
) ;
32
32
}
33
33
34
- public override object ConvertTo ( ITypeDescriptorContext context , CultureInfo culture , object value , Type destType )
34
+ public override object ConvertTo ( ITypeDescriptorContext ? context , CultureInfo ? culture , object ? value , Type destType )
35
35
{
36
36
var fieldName = Enum . GetName ( enumType , value ?? throw new ArgumentNullException ( paramName : nameof ( value ) ) ) ;
37
37
if ( fieldName != null )
@@ -44,17 +44,17 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul
44
44
}
45
45
}
46
46
47
- return value . ToString ( ) ;
47
+ return value . ToString ( ) ! ;
48
48
}
49
49
50
- public override StandardValuesCollection GetStandardValues ( ITypeDescriptorContext context ) => new (
50
+ public override StandardValuesCollection GetStandardValues ( ITypeDescriptorContext ? context ) => new (
51
51
enumType . GetFields ( BindingFlags . Public | BindingFlags . Static )
52
52
. Select ( fi => fi . GetValue ( null ) )
53
53
. ToList ( )
54
54
) ;
55
55
56
- public override bool GetStandardValuesExclusive ( ITypeDescriptorContext context ) => true ;
56
+ public override bool GetStandardValuesExclusive ( ITypeDescriptorContext ? context ) => true ;
57
57
58
- public override bool GetStandardValuesSupported ( ITypeDescriptorContext context ) => true ;
58
+ public override bool GetStandardValuesSupported ( ITypeDescriptorContext ? context ) => true ;
59
59
}
60
60
}
0 commit comments