Я пытаюсь вычесть 2 переменные (float xdiff = x1 - x2;
) из формата с плавающей точкой, однако я получаю сообщение об ошибке «Не удается неявно скрыть тип float? To float». Значения d,c,s,m,radius,x1,y1,x2,y2
получены из windows форм ввода.
Код выглядит следующим образом:
public Nullable<float> d = null;
public Nullable<float> c = null;
public Nullable<float> s = null;
public Nullable<float> m = null;
public Nullable<float> radius = null;
public Nullable<float> x1 = null;
public Nullable<float> y1 = null;
public Nullable<float> x2 = null;
public Nullable<float> y2 = null;
private void Run_Click(object sender, EventArgs e)
{
d = float.Parse(this.downwind.Text);
c = float.Parse(this.crosswind.Text);
s = float.Parse(this.maxcross.Text);
m = float.Parse(this.offset.Text);
radius = float.Parse(this.rad.Text);
x1 = float.Parse(this.x1coord.Text);
y1 = float.Parse(this.y1coord.Text);
x2 = float.Parse(this.x2coord.Text);
y2 = float.Parse(this.y2coord.Text);
float xdiff = x1 - x2;
}