Skip to content

Commit 4537486

Browse files
Simplify code
1 parent 9f76c51 commit 4537486

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/NHibernate/Collection/Generic/SetHelpers/SetSnapShot.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,10 @@ void ICollection.CopyTo(Array array, int index)
120120
return;
121121
}
122122

123-
if (array.GetType().GetElementType().IsAssignableFrom(typeof(T)))
124-
{
125-
if (_hasNull)
126-
array.SetValue(default(T), index);
127-
ICollection keysCollection = _values.Keys;
128-
keysCollection.CopyTo(array, index + (_hasNull ? 1 : 0));
129-
return;
130-
}
131-
132-
throw new ArgumentException($"Array must be of type {typeof(T[])}.", nameof(array));
123+
if (_hasNull)
124+
array.SetValue(default(T), index);
125+
ICollection keysCollection = _values.Keys;
126+
keysCollection.CopyTo(array, index + (_hasNull ? 1 : 0));
133127
}
134128

135129
public int Count => _values.Count + (_hasNull ? 1 : 0);

0 commit comments

Comments
 (0)