Skip to content

Commit c8d017f

Browse files
committed
Refactor ValidateSequenceAttribute to support IEnumerable interface for improved type handling
1 parent bfc8acd commit c8d017f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/Core/Utilities/ValidateSequenceAttribute.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.ComponentModel.DataAnnotations;
1+
using System.Collections;
2+
using System.ComponentModel.DataAnnotations;
23
using System.Globalization;
34

45
namespace Bit.Core.Utilities;
@@ -20,7 +21,7 @@ public class ValidateSequenceAttribute<TValidator> : ValidationAttribute
2021
return ValidationResult.Success;
2122
}
2223

23-
var items = ((IEnumerable<object>)value).ToList();
24+
var items = ((IEnumerable)value).Cast<object>().ToList();
2425
var validator = new TValidator();
2526
var invalid = items.Where(item => !validator.IsValid(item)).ToList();
2627

0 commit comments

Comments
 (0)