I want to read a special value out from a result which came back from a LINQ Query.
Here a snippet:
var query = from O in result.tbl_UserAuths
select O.Status;
foreach (var c in query)
{
Console.Write(c);
}
As a result there will be:
[0] = 1
[1] = 2
[2] = 3
But I do not want to use always first the foreach loop in order to get all the values.
Is there not a method like: Console.Write(query[1].ToString);
in order to get immediately the value 2 from the Index 1.
Thanks.
Loading
Amit ChoudharyPosted Jul 28, 2010, 9:13 AM
if you're using var then you have to go though it using foreach loop but you can use
here's an example code:
IEnumerable
//print the Result
DataTable dt2 = dt.Clone();
TableData.CopyToDataTable(dt2, LoadOption.OverwriteChanges);
and with datatable you can point any row by index immediately.
Hope you get it.
Please mark 'Do you like this post' if it helps you.