Содержание
- 2. доступ возвращаемый_тип методN(список_параметров) { // тело метода } } struct имя_структуры [: интерфейсы] { // Объявления
- 3. доступ возвращаемый_тип метод2(список_параметров) { // тело метода } // . . . доступ возвращаемый_тип методN(список_параметров) {
- 4. 1) class PhoneCustomer { public const string DayOfSendingBill = "Monday"; public int CustomerlD; public string FirstName;
- 5. 4) PhoneCustomer Customer1 = new PhoneCustomer (); Customer1.FirstName = "Simon"; 5) class PhoneCustomer { public const
- 6. 8) public bool IsPositive(int value) ; { if (value return false; return true; } 9) using
- 7. // Instantiate at MathTest object MathTest math = new MathTest(); // this is C#'s way of
- 8. public static int GetSquareOf(int x) { return x*x; } public static double GetPi() { return 3.14159;
- 9. class ParameterTest { static void SomeFunction(int[] ints, int i) { ints[0] = 100; i = 100;
- 10. return 0; } } } 12) ParameterTest.exe i = 0 ints[0) = 0 Вызов SomeFunction... i
- 11. 15) static void SomeFunction (out int i) { i = 100; } public static int Main()
- 12. 18) void TestMethod(int optionalNumber = 10, int notOptionalNumber) { System.Console.Write(optionalNumber + notOptionalNumber); } 19) class ResultDisplayer
- 13. 20) class MyClass { int DoSomething(int x) // нужен 2-й параметр со значением по умолчанию 10
- 14. тип_элемента this[int индекс] { // Аксессор для получения данных get { // Возврат значения, которое определяет
- 15. class FailSoftArray { int[] a; // ссылка на базовый массив public int Length; // открытая переменная
- 16. if(ok(index)) { ErrFlag = false; return a[index]; } else { ErrFlag = true; return 0; }
- 17. // Возвратить логическое значение true, если // индекс находится в установленных границах private bool ok(int index)
- 18. for(int i=0; i { x = fs[i]; if(x != -1) Console.Write(x + " "); } Console.WriteLine();
- 20. 22) public string SomeProperty { get { return "Это значение свойства"; } set { // Сделать
- 21. set { age = value; } } 24) private string name; public string Name { get
- 23. Скачать презентацию