Take this for example:
Now I know that there will only be one record returned into the vData object, but the only way ive been able to get the data from that object is to use a foreach statement.
What id like to know is how I can get at the same data without using a foreach as it seems a little dumb to be using foreach when I know there's only ever going to be one record returned.
Thanks in advance, Daniel.
Code:
var vData = from min in feederData.Vehicle_sizes
where min.Min_passengers <= Convert.ToInt32(txtPax.Text) & min.Max_passengers >= Convert.ToInt32(txtPax.Text)
select new
{
vType = min.Vehicle_Type
};
foreach (var data in vData)
{
txtSize.Text = data.vType.ToString();
}
Now I know that there will only be one record returned into the vData object, but the only way ive been able to get the data from that object is to use a foreach statement.
What id like to know is how I can get at the same data without using a foreach as it seems a little dumb to be using foreach when I know there's only ever going to be one record returned.
Thanks in advance, Daniel.