/// private void..." />
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnClickShowResults(object sender, System.EventArgs e) {
float NumberInput = float.Parse(this.txtNumber.Text);
if (NumberInput < 0) {
this.txtSign.Text = "Negative";
this.txtResult.Text = Math.Sqrt(-NumberInput) + " i";
} else if (NumberInput == 0) {
txtSign.Text = "Zero";
txtResult.Text = "0";
} else {
this.txtSign.Text = "Positive";
this.txtResult.Text = Math.Sqrt(NumberInput).ToString();
}
}
}
class MainEntryClass {
/// <summary>
/// Основная точка входа приложения.
/// </summary>
[STAThread]
static void Main() {
SquareRootForm TheMainForm = new SquareRootForm();
Application.Run(TheMainForm);
}
}
}
Пространства имен
Основная часть исходного кода SquareRoot на C# начинается с объявлений пространств имен и класса:
namespace Wrox.ProfessionalCSharp.AppendixC.SquareRootForm {