I get an error from the following code:
int dreamX[];
private void Form1_Load(object sender, EventArgs e)
{
sumX();
}
private void sumX()
{
for (v
Well, that query might return more than one value, so you need to either use the .Single(), .First() or .FirstOrDefault() extension methods.
Note, that Single()
will only work if there is exactly one element in the list, First()
will only work if there is at least one element in the list. FirstOrDefault()
reverts to the default value (0) if there is no element in the list.
Depending on what exactly you need you will have to choose :)