Skip to content

Commit

Permalink
arrrays #146
Browse files Browse the repository at this point in the history
  • Loading branch information
christiannagel committed Nov 8, 2022
1 parent 5ec3ded commit 6066397
Show file tree
Hide file tree
Showing 21 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion 1_CS/Arrays/ArrayPoolSample/ArrayPoolSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion 1_CS/Arrays/ArrayPoolSample/GlobalUsings.cs

This file was deleted.

4 changes: 3 additions & 1 deletion 1_CS/Arrays/ArrayPoolSample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
for (int i = 0; i < 10; i++)
using System.Buffers;

for (int i = 0; i < 10; i++)
{
int arrayLength = (i + 1) << 10;
int[] arr = ArrayPool<int>.Shared.Rent(arrayLength);
Expand Down
2 changes: 1 addition & 1 deletion 1_CS/Arrays/BitArraySample/BitArraySample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
2 changes: 0 additions & 2 deletions 1_CS/Arrays/BitArraySample/GlobalUsings.cs

This file was deleted.

5 changes: 4 additions & 1 deletion 1_CS/Arrays/BitArraySample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
BitArray bits1 = new(9);
global using System.Collections;
global using System.Text;

BitArray bits1 = new(9);
bits1.SetAll(true);
bits1.Set(1, false);
bits1[5] = false;
Expand Down
2 changes: 1 addition & 1 deletion 1_CS/Arrays/BitVectorSample/BitVectorSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion 1_CS/Arrays/BitVectorSample/GlobalUsings.cs

This file was deleted.

4 changes: 3 additions & 1 deletion 1_CS/Arrays/BitVectorSample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// create a mask using the CreateMask method
using System.Collections.Specialized;

// create a mask using the CreateMask method
BitVector32 bits1 = new();
int bit1 = BitVector32.CreateMask();
int bit2 = BitVector32.CreateMask(bit1);
Expand Down
2 changes: 1 addition & 1 deletion 1_CS/Arrays/IndicesAndRanges/IndicesAndRanges.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
7 changes: 4 additions & 3 deletions 1_CS/Arrays/IndicesAndRanges/MyCollection.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
public class MyCollection
namespace IndicesAndRanges;
public class MyCollection
{
private int[] _array = Enumerable.Range(1, 100).ToArray();

private readonly int[] _array = Enumerable.Range(1, 100).ToArray();
public int Length => _array.Length;

public int this[int index]
Expand Down
4 changes: 3 additions & 1 deletion 1_CS/Arrays/IndicesAndRanges/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
int[] data = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
using IndicesAndRanges;

int[] data = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

// indices and the hat operator

Expand Down
1 change: 0 additions & 1 deletion 1_CS/Arrays/SimpleArrays/Person.cs

This file was deleted.

2 changes: 2 additions & 0 deletions 1_CS/Arrays/SimpleArrays/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,5 @@ void SimpleArrays()
new("Michael", "Schumacher")
};
}

public record Person(string FirstName, string LastName);
2 changes: 1 addition & 1 deletion 1_CS/Arrays/SimpleArrays/SimpleArrays.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion 1_CS/Arrays/SortingSample/PersonComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public enum PersonCompareType

public class PersonComparer : IComparer<Person>
{
private PersonCompareType _compareType;
private readonly PersonCompareType _compareType;

public PersonComparer(PersonCompareType compareType) =>
_compareType = compareType;
Expand Down
2 changes: 1 addition & 1 deletion 1_CS/Arrays/SortingSample/SortingSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion 1_CS/Arrays/SpanSample/SpanSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion 1_CS/Arrays/YieldSample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
HelloWorld();
MusicTitles();

var game = new GameMoves();
GameMoves game = new();

IEnumerator<IEnumerator> enumerator = game.Cross();
while (enumerator.MoveNext())
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion 1_CS/Arrays/YieldSample/YieldSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down

0 comments on commit 6066397

Please sign in to comment.