private static double e_e = Exp(ref time,out Yt(out yp));
You cannot pass the
Yt(out yp)
call as an out parameter.
An out parameter
must be to a variable or field. It must be a
writable location.
I don't know how your
Exp(..., ...)
method is defined.
(Having a name
that similar to
Math.Exp()
is not a good idea, especially since you also are using
Math.Exp()
in this code!)
Show the
Exp(..., ...)
method and I can probably help...
It looks like you really don't need so many out parameters all over the place.
[Edit: MTH]
I'm not sure about this since I still cannot tell what you're actually trying to do.
If you want
Yt
to
always operate on the static
yp
value,
and always to update it then maybe something like:
public static double Yt()
{
yp = Xp*B*P*miuk*(1 - Math.Exp(-(e_e))) + (yp*(Math.Exp(-(e_e))));
return yp;
}
Otherwise, maybe more like:
public static double miuk;
public static double yp = Yt(0);
private static double e_e = Exp(time, yp);
private static double N1, N2, N3, N4, C1, C2, C3, C4;
private static double Exp1 = Summation(ref N1, ref C1, ref N2, ref C2, ref N3, ref C3, ref N4, ref C4);
public static double SN(ref double miuK,out double yp)
{
yp = 0;
return Xp*B*P*((miuK*(1-Math.Exp(-(e_e)))-1)+(yp*Math.Exp(-(e_e))*Exp1));
}
public static double Yt(double ypParam)
{
return Xp*B*P*miuk*(1 - Math.Exp(-(e_e))) + (ypParam*(Math.Exp(-(e_e))));
}
public static double Exp(double rtime, double ypParam)
{
return Math.Exp(-(Q*F - Yt(ypParam))*Lamda)*rtime;
}
As a general rule, lots of use of
out
(and/or
ref
) parameters, and lots of
static
fields (variables) is a sign that the code was not thought out before implementing! (a.k.a., "code smell")