@@ -33,7 +33,7 @@ public class ValueComparer<T> : ValueComparer, IEqualityComparer<T>
33
33
{
34
34
private Func < T ? , T ? , bool > ? _equals ;
35
35
private Func < T , int > ? _hashCode ;
36
- private Func < T ? , T ? > ? _snapshot ;
36
+ private Func < T , T > ? _snapshot ;
37
37
38
38
/// <summary>
39
39
/// Creates a new <see cref="ValueComparer{T}" /> with a default comparison
@@ -82,7 +82,7 @@ public ValueComparer(
82
82
public ValueComparer (
83
83
Expression < Func < T ? , T ? , bool > > equalsExpression ,
84
84
Expression < Func < T , int > > hashCodeExpression ,
85
- Expression < Func < T ? , T ? > > snapshotExpression )
85
+ Expression < Func < T , T > > snapshotExpression )
86
86
: base ( equalsExpression , hashCodeExpression , snapshotExpression )
87
87
{
88
88
}
@@ -161,7 +161,7 @@ public ValueComparer(
161
161
/// Creates an expression for creating a snapshot of a value.
162
162
/// </summary>
163
163
/// <returns> The snapshot expression. </returns>
164
- protected static Expression < Func < T ? , T ? > > CreateDefaultSnapshotExpression ( bool favorStructuralComparisons )
164
+ protected static Expression < Func < T , T > > CreateDefaultSnapshotExpression ( bool favorStructuralComparisons )
165
165
{
166
166
if ( ! favorStructuralComparisons
167
167
|| ! typeof ( T ) . IsArray )
@@ -178,7 +178,7 @@ public ValueComparer(
178
178
// var destination = new T[length];
179
179
// Array.Copy(source, destination, length);
180
180
// return destination;
181
- return Expression . Lambda < Func < T ? , T ? > > (
181
+ return Expression . Lambda < Func < T , T > > (
182
182
Expression . Block (
183
183
new [ ] { lengthVariable , destinationVariable } ,
184
184
Expression . Assign (
@@ -257,8 +257,8 @@ public override bool Equals(object? left, object? right)
257
257
/// </summary>
258
258
/// <param name="instance"> The instance. </param>
259
259
/// <returns> The hash code. </returns>
260
- public override int GetHashCode ( object ? instance )
261
- => instance == null ? 0 : GetHashCode ( ( T ) instance ) ;
260
+ public override int GetHashCode ( object instance )
261
+ => instance is null ? 0 : GetHashCode ( ( T ) instance ) ;
262
262
263
263
/// <summary>
264
264
/// Compares the two instances to determine if they are equal.
@@ -293,7 +293,7 @@ public virtual int GetHashCode(T instance)
293
293
/// <param name="instance"> The instance. </param>
294
294
/// <returns> The snapshot. </returns>
295
295
public override object ? Snapshot ( object ? instance )
296
- => instance == null ? null : Snapshot ( ( T ? ) instance ) ;
296
+ => instance == null ? null : Snapshot ( ( T ) instance ) ;
297
297
298
298
/// <summary>
299
299
/// <para>
@@ -308,7 +308,7 @@ public virtual int GetHashCode(T instance)
308
308
/// </summary>
309
309
/// <param name="instance"> The instance. </param>
310
310
/// <returns> The snapshot. </returns>
311
- public virtual T ? Snapshot ( T ? instance )
311
+ public virtual T Snapshot ( T instance )
312
312
=> NonCapturingLazyInitializer . EnsureInitialized (
313
313
ref _snapshot , this , static c => c . SnapshotExpression . Compile ( ) ) ( instance ) ;
314
314
@@ -341,7 +341,7 @@ public override Type Type
341
341
/// reference.
342
342
/// </para>
343
343
/// </summary>
344
- public new virtual Expression < Func < T ? , T ? > > SnapshotExpression
345
- => ( Expression < Func < T ? , T ? > > ) base . SnapshotExpression ;
344
+ public new virtual Expression < Func < T , T > > SnapshotExpression
345
+ => ( Expression < Func < T , T > > ) base . SnapshotExpression ;
346
346
}
347
347
}
0 commit comments