I have the following function to get validation errors for a card. My question relates to dealing with GetErrors. Both methods have the same return type IEnumerable<ErrorInfo>
.
private static IEnumerable<ErrorInfo> GetErrors(Card card)
{
var errors = GetMoreErrors(card);
foreach (var e in errors)
yield return e;
// further yield returns for more validation errors
}
Is it possible to return all the errors in GetMoreErrors
without having to enumerate through them?
Thinking about it this is probably a stupid question, but I want to make sure I'm not going wrong.