File tree Expand file tree Collapse file tree
src/components/BootstrapBlazor.Region/Components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,30 +42,22 @@ private async Task OnClearValue()
4242
4343 private void OnSelectProvince ( string province )
4444 {
45- if ( IsMultiple )
45+ if ( ! IsMultiple )
4646 {
47- HashSet < string > cities ;
48- if ( province == "直辖市" )
49- {
50- cities = Municipalities ;
51- }
52- else if ( province == "特别行政区" )
53- {
54- cities = SpecialAdministrativeRegions ;
55- }
56- else
57- {
58- cities = GetCities ( province ) ;
59- }
60- foreach ( var city in cities )
61- {
62- if ( ! _values . Remove ( city ) )
63- {
64- _values . Add ( city ) ;
65- }
66- }
67- CurrentValue = string . Join ( "," , _values ) ;
47+ return ;
48+ }
49+
50+ HashSet < string > cities = province switch
51+ {
52+ "直辖市" => Municipalities ,
53+ "特别行政区" => SpecialAdministrativeRegions ,
54+ _ => GetCities ( province )
55+ } ;
56+ foreach ( var city in cities . Where ( city => ! _values . Remove ( city ) ) )
57+ {
58+ _values . Add ( city ) ;
6859 }
60+ CurrentValue = string . Join ( "," , _values ) ;
6961 }
7062
7163 private void OnSelectCity ( string item )
You can’t perform that action at this time.
0 commit comments