use
Enumerable.First(TSource) [
^]
var temp = new
{
val1 = dataset.Tables[1].AsEnumerable().Where(z => z.Field<int>("Id") == 1000).Select(x => x.Field<string>("Name")).First(),
val2 = dataset.Tables[1].AsEnumerable().Where(z => z.Field<int>("Id") == 1000).Select(x => x.Field<int>("TypeId")).First()
};</int></int></string></int>
now val1 will be of type
string
and val2 as
int
better way
DataRow row = dataset.Tables[1].AsEnumerable().FirstOrDefault(z => z.Field<int>("Id") == 1000);
if (row != null)
{
var temp = new { val1 = row.Field<string>("Name"), val2 = row.Field<string>("Name"), };
}</string></string></int>