Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit43a12ab

Browse files
committed
chore: refactor to ArgumentNullException.ThrowIfNull
1 parentfbee726 commit43a12ab

File tree

6 files changed

+16
-30
lines changed

6 files changed

+16
-30
lines changed

‎src/Maui/Prism.Maui/Navigation/Regions/Adapters/CarouselViewRegionAdapter.cs‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
usingSystem.Collections.Specialized;
1+
usingSystem.Collections.Specialized;
22
usingPrism.Behaviors;
33
usingPrism.Common;
4-
usingPrism.Ioc;
54
usingPrism.Mvvm;
65
usingPrism.Properties;
76

@@ -29,8 +28,8 @@ public CarouselViewRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)
2928
/// <param name="regionTarget">The object to adapt.</param>
3029
protectedoverridevoidAdapt(IRegionregion,CarouselViewregionTarget)
3130
{
32-
if(regionTarget==null)
33-
thrownewArgumentNullException(nameof(regionTarget));
31+
ArgumentNullException.ThrowIfNull(region);
32+
ArgumentNullException.ThrowIfNull(regionTarget);
3433

3534
boolitemsSourceIsSet=regionTarget.ItemsSource!=null||regionTarget.IsSet(ItemsView.ItemsSourceProperty);
3635

‎src/Maui/Prism.Maui/Navigation/Regions/Adapters/CollectionViewRegionAdapter.cs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
usingPrism.Ioc;
21
usingPrism.Properties;
32

43
namespacePrism.Navigation.Regions.Adapters;
@@ -25,11 +24,8 @@ public CollectionViewRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)
2524
/// <param name="regionTarget">The object to adapt.</param>
2625
protectedoverridevoidAdapt(IRegionregion,CollectionViewregionTarget)
2726
{
28-
if(region==null)
29-
thrownewArgumentNullException(nameof(region));
30-
31-
if(regionTarget==null)
32-
thrownewArgumentNullException(nameof(regionTarget));
27+
ArgumentNullException.ThrowIfNull(region);
28+
ArgumentNullException.ThrowIfNull(regionTarget);
3329

3430
boolitemsSourceIsSet=regionTarget.ItemsSource!=null||regionTarget.IsSet(ItemsView.ItemsSourceProperty);
3531

‎src/Maui/Prism.Maui/Navigation/Regions/Adapters/ContentViewRegionAdapter{TContentView}.cs‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
usingSystem.Collections.Specialized;
2-
usingPrism.Ioc;
1+
usingSystem.Collections.Specialized;
32
usingPrism.Properties;
43

54
namespacePrism.Navigation.Regions.Adapters;
@@ -27,8 +26,8 @@ public ContentViewRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)
2726
/// <param name="regionTarget">The object to adapt.</param>
2827
protectedoverridevoidAdapt(IRegionregion,TContentViewregionTarget)
2928
{
30-
if(regionTarget==null)
31-
thrownewArgumentNullException(nameof(regionTarget));
29+
ArgumentNullException.ThrowIfNull(region);
30+
ArgumentNullException.ThrowIfNull(regionTarget);
3231

3332
boolcontentIsSet=regionTarget.Content!=null||regionTarget.IsSet(ContentView.ContentProperty);
3433

‎src/Maui/Prism.Maui/Navigation/Regions/Adapters/LayoutViewRegionAdapter.cs‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ public LayoutViewRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)
2525
/// <param name="regionTarget">The object to adapt.</param>
2626
protectedoverridevoidAdapt(IRegionregion,Layout<View>regionTarget)
2727
{
28-
if(region==null)
29-
thrownewArgumentNullException(nameof(region));
30-
31-
if(regionTarget==null)
32-
thrownewArgumentNullException(nameof(regionTarget));
28+
ArgumentNullException.ThrowIfNull(region);
29+
ArgumentNullException.ThrowIfNull(regionTarget);
3330

3431
boolitemsSourceIsSet=regionTarget.Children?.Any()??false||regionTarget.IsSet(BindableLayout.ItemsSourceProperty);
3532

‎src/Maui/Prism.Maui/Navigation/Regions/Adapters/RegionAdapterBase.cs‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
usingSystem.Globalization;
1+
usingSystem.Globalization;
22
usingPrism.Extensions;
3-
usingPrism.Ioc;
43
usingPrism.Navigation.Regions.Behaviors;
54
usingPrism.Navigation.Xaml;
65
usingPrism.Properties;
@@ -75,11 +74,8 @@ IRegion IRegionAdapter.Initialize(object regionTarget, string regionName)
7574
/// <param name="regionTarget">The object to adapt.</param>
7675
protectedvirtualvoidAttachDefaultBehaviors(IRegionregion,TregionTarget)
7776
{
78-
if(region==null)
79-
thrownewArgumentNullException(nameof(region));
80-
81-
if(regionTarget==null)
82-
thrownewArgumentNullException(nameof(regionTarget));
77+
ArgumentNullException.ThrowIfNull(region);
78+
ArgumentNullException.ThrowIfNull(regionTarget);
8379

8480
IRegionBehaviorFactorybehaviorFactory=RegionBehaviorFactory;
8581
if(behaviorFactory!=null)

‎src/Maui/Prism.Maui/Navigation/Regions/Adapters/ScrollViewRegionAdapter.cs‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
usingSystem.Collections.Specialized;
2-
usingPrism.Ioc;
1+
usingSystem.Collections.Specialized;
32
usingPrism.Properties;
43

54
namespacePrism.Navigation.Regions.Adapters;
@@ -26,8 +25,8 @@ public ScrollViewRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)
2625
/// <param name="regionTarget">The object to adapt.</param>
2726
protectedoverridevoidAdapt(IRegionregion,ScrollViewregionTarget)
2827
{
29-
if(regionTarget==null)
30-
thrownewArgumentNullException(nameof(regionTarget));
28+
ArgumentNullException.ThrowIfNull(region);
29+
ArgumentNullException.ThrowIfNull(regionTarget);
3130

3231
// No binding check required as the ContentProperty is not Bindable
3332
boolcontentIsSet=regionTarget.Content!=null;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp