7
7
using System ;
8
8
using System . Collections . Generic ;
9
9
using System . ComponentModel ;
10
+ using System . Diagnostics . CodeAnalysis ;
10
11
using System . Runtime . CompilerServices ;
11
12
using System . Threading . Tasks ;
12
13
@@ -50,7 +51,7 @@ protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
50
51
/// <remarks>
51
52
/// The <see cref="PropertyChanged"/> event is not raised if the current and new value for the target property are the same.
52
53
/// </remarks>
53
- protected bool SetProperty < T > ( ref T field , T newValue , [ CallerMemberName ] string ? propertyName = null )
54
+ protected bool SetProperty < T > ( [ NotNullIfNotNull ( "newValue" ) ] ref T field , T newValue , [ CallerMemberName ] string ? propertyName = null )
54
55
{
55
56
if ( EqualityComparer < T > . Default . Equals ( field , newValue ) )
56
57
{
@@ -75,7 +76,7 @@ protected bool SetProperty<T>(ref T field, T newValue, [CallerMemberName] string
75
76
/// <param name="comparer">The <see cref="IEqualityComparer{T}"/> instance to use to compare the input values.</param>
76
77
/// <param name="propertyName">(optional) The name of the property that changed.</param>
77
78
/// <returns><see langword="true"/> if the property was changed, <see langword="false"/> otherwise.</returns>
78
- protected bool SetProperty < T > ( ref T field , T newValue , IEqualityComparer < T > comparer , [ CallerMemberName ] string ? propertyName = null )
79
+ protected bool SetProperty < T > ( [ NotNullIfNotNull ( "newValue" ) ] ref T field , T newValue , IEqualityComparer < T > comparer , [ CallerMemberName ] string ? propertyName = null )
79
80
{
80
81
if ( comparer . Equals ( field , newValue ) )
81
82
{
@@ -280,7 +281,7 @@ protected bool SetProperty<TModel, T>(T oldValue, T newValue, IEqualityComparer<
280
281
/// <paramref name="taskNotifier"/> is different than the previous one, and it does not mean the new
281
282
/// <see cref="Task"/> instance passed as argument is in any particular state.
282
283
/// </remarks>
283
- protected bool SetPropertyAndNotifyOnCompletion ( ref TaskNotifier ? taskNotifier , Task ? newValue , [ CallerMemberName ] string ? propertyName = null )
284
+ protected bool SetPropertyAndNotifyOnCompletion ( [ NotNull ] ref TaskNotifier ? taskNotifier , Task ? newValue , [ CallerMemberName ] string ? propertyName = null )
284
285
{
285
286
return SetPropertyAndNotifyOnCompletion ( taskNotifier ??= new ( ) , newValue , static _ => { } , propertyName ) ;
286
287
}
@@ -300,7 +301,7 @@ protected bool SetPropertyAndNotifyOnCompletion(ref TaskNotifier? taskNotifier,
300
301
/// <remarks>
301
302
/// The <see cref="PropertyChanged"/> event is not raised if the current and new value for the target property are the same.
302
303
/// </remarks>
303
- protected bool SetPropertyAndNotifyOnCompletion ( ref TaskNotifier ? taskNotifier , Task ? newValue , Action < Task ? > callback , [ CallerMemberName ] string ? propertyName = null )
304
+ protected bool SetPropertyAndNotifyOnCompletion ( [ NotNull ] ref TaskNotifier ? taskNotifier , Task ? newValue , Action < Task ? > callback , [ CallerMemberName ] string ? propertyName = null )
304
305
{
305
306
return SetPropertyAndNotifyOnCompletion ( taskNotifier ??= new ( ) , newValue , callback , propertyName ) ;
306
307
}
@@ -338,7 +339,7 @@ protected bool SetPropertyAndNotifyOnCompletion(ref TaskNotifier? taskNotifier,
338
339
/// <paramref name="taskNotifier"/> is different than the previous one, and it does not mean the new
339
340
/// <see cref="Task{TResult}"/> instance passed as argument is in any particular state.
340
341
/// </remarks>
341
- protected bool SetPropertyAndNotifyOnCompletion < T > ( ref TaskNotifier < T > ? taskNotifier , Task < T > ? newValue , [ CallerMemberName ] string ? propertyName = null )
342
+ protected bool SetPropertyAndNotifyOnCompletion < T > ( [ NotNull ] ref TaskNotifier < T > ? taskNotifier , Task < T > ? newValue , [ CallerMemberName ] string ? propertyName = null )
342
343
{
343
344
return SetPropertyAndNotifyOnCompletion ( taskNotifier ??= new ( ) , newValue , static _ => { } , propertyName ) ;
344
345
}
@@ -359,7 +360,7 @@ protected bool SetPropertyAndNotifyOnCompletion<T>(ref TaskNotifier<T>? taskNoti
359
360
/// <remarks>
360
361
/// The <see cref="PropertyChanged"/> event is not raised if the current and new value for the target property are the same.
361
362
/// </remarks>
362
- protected bool SetPropertyAndNotifyOnCompletion < T > ( ref TaskNotifier < T > ? taskNotifier , Task < T > ? newValue , Action < Task < T > ? > callback , [ CallerMemberName ] string ? propertyName = null )
363
+ protected bool SetPropertyAndNotifyOnCompletion < T > ( [ NotNull ] ref TaskNotifier < T > ? taskNotifier , Task < T > ? newValue , Action < Task < T > ? > callback , [ CallerMemberName ] string ? propertyName = null )
363
364
{
364
365
return SetPropertyAndNotifyOnCompletion ( taskNotifier ??= new ( ) , newValue , callback , propertyName ) ;
365
366
}
0 commit comments