2

Is it possible to create one chained linq statements to create an IEnumerable(Of String) of error messages from ViewData.ModelState?

I have tried:

Dim errorlist = ViewData.ModelState.Select(
    Function(m) m.Value.Errors.Select(
        Function(e) e.ErrorMessage))

But that linq produces IEnumerable(Of IEnumerable(Of String)).

2
  • Try SelectMany instead of Select Commented Sep 26, 2012 at 7:18
  • @karaxuna Thanks! Will you post it as answer? Commented Sep 26, 2012 at 7:38

1 Answer 1

1
Dim errorlist = ViewData.ModelState.SelectMany(
Function(m) m.Value.Errors.Select(
    Function(e) e.ErrorMessage))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.