@@ -1028,19 +1028,14 @@ internal TypeConverter FindConverterByType(TypeConverterAttribute attr)
1028
1028
// throws SecurityException or MethodAccessException when the converter class is internal.
1029
1029
// Thats why we have this giant if - elseif here - to create type converters without reflection.
1030
1030
if ( _converterDict . Contains ( attr . ConverterTypeName ) )
1031
- {
1032
1031
return ( TypeConverter ) _converterDict [ attr . ConverterTypeName ] ;
1033
- }
1034
-
1035
- string typeStr = attr . ConverterTypeName ;
1036
1032
1037
- if ( attr . ConverterTypeName . Contains ( ',' ) )
1038
- {
1039
- typeStr = attr . ConverterTypeName . Split ( ',' ) [ 0 ] ;
1040
- }
1033
+ ReadOnlySpan < char > typeStr = attr . ConverterTypeName . AsSpan ( ) ;
1034
+ int ind ;
1035
+ if ( ( ind = typeStr . IndexOf ( ',' ) ) > - 1 )
1036
+ typeStr = typeStr [ .. ind ] ;
1041
1037
1042
1038
TypeConverter result = null ;
1043
-
1044
1039
if ( typeStr . EndsWith ( ".CustomPropertiesTypeConverter" , StringComparison . OrdinalIgnoreCase ) ) { result = new CustomPropertiesTypeConverter ( ) ; }
1045
1040
else if ( typeStr . EndsWith ( ".DoubleNanValueConverter" , StringComparison . OrdinalIgnoreCase ) ) { result = new DoubleNanValueConverter ( ) ; }
1046
1041
else if ( typeStr . EndsWith ( ".DoubleDateNanValueConverter" , StringComparison . OrdinalIgnoreCase ) ) { result = new DoubleDateNanValueConverter ( ) ; }
@@ -1072,7 +1067,8 @@ internal TypeConverter FindConverterByType(TypeConverterAttribute attr)
1072
1067
else if ( typeStr . EndsWith ( ".AnchorPointValueConverter" , StringComparison . OrdinalIgnoreCase ) ) { result = new AnchorPointValueConverter ( ) ; }
1073
1068
else if ( typeStr . EndsWith ( ".AnnotationAxisValueConverter" , StringComparison . OrdinalIgnoreCase ) ) { result = new AnnotationAxisValueConverter ( ) ; }
1074
1069
1075
- if ( result != null ) _converterDict [ attr . ConverterTypeName ] = result ;
1070
+ if ( result is not null )
1071
+ _converterDict [ attr . ConverterTypeName ] = result ;
1076
1072
1077
1073
return result ;
1078
1074
}
0 commit comments