Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
What I need to do is select list of nested elements, here is my query which returns IEnumerable<IEnumerable<object>> here is my li
returns
IEnumerable<IEnumerable<object>>
What I need to do is select list of nested elements, here is my query which returns IEnumerable<IEnumerable<object>> here is my linq expression:
from a in (questions.Select(x => x.AnswerList).ToList()) select a.Select(x => x.AnswerBasicViewModel);
How should I do that to make it return only IEnumerable<object> instead of IEnumerable<IEnumerable<object>>?
return
IEnumerable<object>
Just to be clear in my sample I would like to get IEnumerable<AnswerBasicViewModel>.
IEnumerable<AnswerBasicViewModel>
Hi I'm new in PHP need some help, i want to generate auto registration code like this (e.g: 0001, 0002, ..) form data base if available in database auto plus one in last number if not start from 0000 it go at 9999 and stop
my sql table as
id | regisCode | title
query is
$query = mysql_query("Select * from accounts"); $result = mysql_num_rows($query); if ($result > 0){ $row = mysql_fetch_array ($result); } else{ $new = 0000; } $account = substr('0000', 1); $faccount = 1+$account; echo "<h1>". $faccount ."</h1>";
sorry for poor english
使用SelectMany运算符:
SelectMany
from q in questions from a in q.AnswerList select a.AnswerBasicViewModel
或者干脆
questions.SelectMany(q => q.AnswerList) .Select(a => a.AnswerBasicViewModel)
SelectMany 是去这里的方式:
questions.SelectMany(x => x.AnswerList).Select(x => x.AnswerBasicViewModel);