Skip to content

Commit 2cd88b7

Browse files
.net 8 - operators #203
1 parent 262b6cd commit 2cd88b7

File tree

9 files changed

+12
-19
lines changed

9 files changed

+12
-19
lines changed

1_CS/OperatorsAndCasts/BinaryCalculations/BinaryCalculations.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/OperatorsAndCasts/BinaryCalculations/BinaryExtensions.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88

99
public static string AddSeparators(this string number) =>
1010
string.Join("_",
11-
Enumerable.Range(0, number.Length / 4)
12-
.Select(i => number.Substring(i * 4, 4)).ToArray());
11+
[.. Enumerable.Range(0, number.Length / 4).Select(i => number.Substring(i * 4, 4))]);
1312
}

1_CS/OperatorsAndCasts/CustomIndexerSample/CustomIndexerSample.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/OperatorsAndCasts/CustomIndexerSample/PersonCollection.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
public class PersonCollection
22
{
3-
private Person[] _people;
3+
private readonly Person[] _people;
44

55
public PersonCollection(params Person[] people) =>
6-
_people = people.ToArray();
6+
_people = [.. people];
77

88
public Person this[int index]
99
{

1_CS/OperatorsAndCasts/EqualitySample/Book.cs

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
class Book : IEquatable<Book>
1+
class Book(string title, string publisher) : IEquatable<Book>
22
{
3-
public Book(string title, string publisher)
4-
{
5-
Title = title;
6-
Publisher = publisher;
7-
}
8-
9-
public string Title { get; }
10-
public string Publisher { get; }
3+
public string Title { get; } = title;
4+
public string Publisher { get; } = publisher;
115

126
protected virtual Type EqualityContract { get; } = typeof(Book);
137

1_CS/OperatorsAndCasts/EqualitySample/EqualitySample.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/OperatorsAndCasts/OperatorOverloadingSample/OperatorOverloadingSample.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/OperatorsAndCasts/OperatorsSample/OperatorsSample.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
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>

1_CS/OperatorsAndCasts/UserDefinedConversion/UserDefinedConversion.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)