You've declared the method to return a
double
but are trying to return
double?[]
.
Edit [MTH]:
private void cmdCHART_Click(object sender, EventArgs e)
{
nmCHART.clsCHART oCHART = new nmCHART.clsCHART();
double[] Y = oCHART.GET_Y_SERIES("CONDOR");
}
namespace nmCHART
{
public class clsCHART
{
public double[] GET_Y_SERIES(string GREEK)
{
var qryY = (from P in Globals.DATA.PAYOFF_EAVs
where P.GREEK == GREEK
&& P.DATA != null
orderby P.DP_NO
select P.DATA).OfType<double>().ToArray();
return qryY;
}
}
}
The
.OfType<double>()
casts all of the values to
double
from
double?
so the caller can use it without having to be concerned about
null
s.
Also, the
.OfType<double>()
will filter out the
null
values, so the
null
check in the query is not necessary, but, if this is actually a database query, the
null
check would be executed on the server side, so it could be more efficient.