Урок 3.3
This commit is contained in:
parent
837beff6c4
commit
66a8e1f860
@ -142,3 +142,20 @@ class Person
|
|||||||
personAge = age;
|
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");
|
||||||
|
}
|
||||||
@ -1,21 +1,7 @@
|
|||||||
Person person = new Person("Tom", 33);
|
Person tom = new();
|
||||||
(string name, int age) = person; //(_, int age) = person если нужен только возраст
|
tom.SayHello();
|
||||||
Console.WriteLine(name);
|
|
||||||
|
|
||||||
|
|
||||||
class Person
|
class Person
|
||||||
{
|
{
|
||||||
string name;
|
public void SayHello() => Console.WriteLine("Hello");
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,10 +13,10 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("CSHARP")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("CSHARP")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[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.AssemblyProductAttribute("CSHARP")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("CSHARP")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("CSHARP")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
// Создано классом WriteCodeFragment MSBuild.
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
e5d3a2d50b713fd5feb66a02c824290572091f66fdfcd5902a5e5cb105d4cb38
|
de142c11f05cd3451d0fc80307c6b9777eff4cdf53e21bc224e6160abef0828c
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user