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
    – karaxuna
    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))

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.