Skip to content

Commit 31004d3

Browse files
.net 8 - types #203
1 parent 674d4d7 commit 31004d3

File tree

15 files changed

+20
-33
lines changed

15 files changed

+20
-33
lines changed

1_CS/Types/ClassesSample/Book.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11

2-
public class Book
2+
public class Book(string title)
33
{
4-
public Book(string title)
5-
{
6-
Title = title;
7-
}
8-
9-
public string Title { get; init; }
4+
public string Title { get; init; } = title;
105
public string? Publisher { get; init; }
116
}

1_CS/Types/ClassesSample/ClassesSample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>

1_CS/Types/ClassesSample/Person.cs

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
public class Person
2-
{
3-
public Person(string firstName, string lastName)
4-
{
5-
_firstName = firstName;
6-
_lastName = lastName;
7-
}
8-
9-
private readonly string _firstName;
1+
public class Person(string firstName, string lastName)
2+
{
3+
private readonly string _firstName = firstName;
104
public string FirstName => _firstName;
11-
private readonly string _lastName;
5+
private readonly string _lastName = lastName;
126
public string LastName => _lastName;
137

148
public string FullName => $"{FirstName} {LastName}";

1_CS/Types/EnumSample/DaysOfWeek.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
2-
3-
[Flags]
1+
[Flags]
42
public enum DaysOfWeek
53
{
64
Monday = 0x1,

1_CS/Types/EnumSample/EnumSample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>

1_CS/Types/ExtensionMethods/ExtensionMethods.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>

1_CS/Types/MathSample/MathSample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>

1_CS/Types/MethodSample/MethodSample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>

1_CS/Types/PatternMatchingSample/PatternMatchingSample.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
6-
<Nullable>enable</Nullable>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>
99

1_CS/Types/RecordsSample/RecordsSample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>

1_CS/Types/RefInOutSample/RefInOutSample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>

1_CS/Types/StructRecordSample/StructRecordSample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>

1_CS/Types/StructsSample/StructsSample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>

1_CS/Types/TuplesSample/TuplesSample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>

1_CS/Types/TypesSample/TypesSample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>

0 commit comments

Comments
 (0)