Skip to content

Commit 9b8c007

Browse files
Fixes CombineSequence behaviour
1 parent 16b8291 commit 9b8c007

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CommonUtilitiesCSharp/Utils/HashCodeHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public static int CombineSequence<T>(IEnumerable<T> values)
3838
/// <exception cref="InvalidOperationException">Thrown to avoid accidental misuse of the method, when the given argument array contains a single enumerable of values, whereas it would be expected to combine the values within that enumerable instead.</exception>
3939
public static int CombineSequence<T>(params T[] values)
4040
{
41-
if (values.Length == 1 && values is IEnumerable) // This is not ideal and goes against some conventions, but it's the best way to avoid accidental misuse.
42-
throw new InvalidOperationException($"Method cannot be used with a single {nameof(IEnumerable)} parameter to avoid misuse. The generic type {nameof(T)} must be specified manually.");
41+
if (values.Length == 1 && values[0] is IEnumerable)
42+
throw new InvalidOperationException($"Method called with a single {nameof(IEnumerable)} parameter. This is blocked to avoid unintended behaviour. Specify the generic type {nameof(T)} manually to obtain the correct behaviour.");
4343

4444
return CombineSequence(values.AsEnumerable());
4545
}

0 commit comments

Comments
 (0)