Урок 3.3

This commit is contained in:
deadzilla 2026-05-04 20:57:17 +05:00
parent 837beff6c4
commit 66a8e1f860
12 changed files with 24 additions and 21 deletions

View File

@ -141,4 +141,21 @@ class Person
personName = name;
personAge = age;
}
}
"Класс Program и метод Main. Программы верхнего уровня"
string hello = "Hello";
Print(hello);
void Print(string message)
{
Console.WriteLine(message);
}
Person tom = new();
tom.SayHello();
class Person
{
public void SayHello() => Console.WriteLine("Hello");
}

View File

@ -1,21 +1,7 @@
Person person = new Person("Tom", 33);
(string name, int age) = person; //(_, int age) = person если нужен только возраст
Console.WriteLine(name);
Person tom = new();
tom.SayHello();
class Person
{
string name;
int age;
public Person(string name, int age)
{
this.name;
this.age;
}
public void Deconstruct(out string personName, out int personAge)
{
personName = name;
personAge = age;
}
}
public void SayHello() => Console.WriteLine("Hello");
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("CSHARP")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a385581ef2126891ffe561caf708150c6ef0c3cd")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+837beff6c4cc7361396562a13cbbd8cb10871924")]
[assembly: System.Reflection.AssemblyProductAttribute("CSHARP")]
[assembly: System.Reflection.AssemblyTitleAttribute("CSHARP")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
// Создано классом WriteCodeFragment MSBuild.

View File

@ -1 +1 @@
e5d3a2d50b713fd5feb66a02c824290572091f66fdfcd5902a5e5cb105d4cb38
de142c11f05cd3451d0fc80307c6b9777eff4cdf53e21bc224e6160abef0828c

Binary file not shown.

Binary file not shown.

Binary file not shown.