File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -439,7 +439,17 @@ public static (string FieldName, string PropertyName) GetGeneratedFieldAndProper
439
439
440
440
propertyName += "Command" ;
441
441
442
- string fieldName = $ "{ char . ToLower ( propertyName [ 0 ] , CultureInfo . InvariantCulture ) } { propertyName . Substring ( 1 ) } ";
442
+ char firstCharacter = propertyName [ 0 ] ;
443
+ char loweredFirstCharacter = char . ToLower ( firstCharacter , CultureInfo . InvariantCulture ) ;
444
+
445
+ // The field name is generated depending on whether the first character can be lowered:
446
+ // - If it can, then the field name is just the property name starting in lowercase.
447
+ // - If it can't (eg. starts with '中'), then the '_' prefix is added to the property name.
448
+ string fieldName = ( firstCharacter == loweredFirstCharacter ) switch
449
+ {
450
+ true => $ "_{ propertyName } ",
451
+ false => $ "{ loweredFirstCharacter } { propertyName . Substring ( 1 ) } "
452
+ } ;
443
453
444
454
return ( fieldName , propertyName ) ;
445
455
}
You can’t perform that action at this time.
0 commit comments