Skip to content

Commit cde64f2

Browse files
committed
Working on sorting.
1 parent d6bdcee commit cde64f2

File tree

13 files changed

+965
-832
lines changed

13 files changed

+965
-832
lines changed

source/code/projects/Actions/Actions/CallingAction.cs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22

33
public static class CallingAction
44
{
5-
public static void Demo(Action actionP)
6-
{
7-
Console.WriteLine("Now calling action: ");
8-
actionP();
9-
Console.WriteLine("Done calling action.");
10-
}
5+
public static void Demo(Action actionP)
6+
{
7+
Console.WriteLine("Now calling action: ");
8+
actionP();
9+
Console.WriteLine("Done calling action.");
10+
}
1111

12-
public static void DemoT(Action<int> actionP)
12+
public static void DemoT(Action<int> actionP)
13+
{
14+
Console.WriteLine(
15+
"Now calling action with arguments ranging from 0 to 9:"
16+
);
17+
for (int i = 0; i < 10; i++)
1318
{
14-
Console.WriteLine("Now calling action with arguments ranging from 0 to 9:");
15-
for (int i = 0; i < 10; i++)
16-
{
17-
actionP(i);
18-
}
19-
Console.WriteLine("Done calling action.");
19+
actionP(i);
2020
}
21-
}
21+
Console.WriteLine("Done calling action.");
22+
}
23+
}

source/code/projects/Actions/Actions/ExampleActions.cs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,24 @@
22

33
public static class ExampleActions
44
{
5-
public static void Test()
6-
{
7-
Console.WriteLine("Test");
8-
}
9-
public static void Display(int i)
10-
{
11-
Console.WriteLine(i);
12-
}
5+
public static void Test()
6+
{
7+
Console.WriteLine("Test");
8+
}
9+
10+
public static void Display(int i)
11+
{
12+
Console.WriteLine(i);
13+
}
1314
}
1415

1516
public static class ExampleActions<T>
1617
{
17-
public static void DisplayArray(T[] arrayP)
18+
public static void DisplayArray(T[] arrayP)
19+
{
20+
for (int i = 0; i < arrayP.Length; i++)
1821
{
19-
for (int i = 0; i < arrayP.Length; i++)
20-
{
21-
Console.WriteLine(arrayP[i]);
22-
}
22+
Console.WriteLine(arrayP[i]);
2323
}
24+
}
2425
}

source/code/projects/Actions/Actions/Program.cs

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,32 @@
22

33
class Program
44
{
5-
static void Main()
6-
{
7-
// We can call our methods directly:
8-
ExampleActions.Test();
9-
ExampleActions.Display(3);
10-
ExampleActions<int>.DisplayArray(new int[] { 20, 30, 40 });
5+
static void Main()
6+
{
7+
// We can call our methods directly:
8+
ExampleActions.Test();
9+
ExampleActions.Display(3);
10+
ExampleActions<int>.DisplayArray(
11+
new int[] { 20, 30, 40 }
12+
);
1113

12-
// Or we can store them
13-
// in variables and then call them:
14+
// Or we can store them
15+
// in variables and then call them:
1416

15-
Action test_variable = ExampleActions.Test;
16-
test_variable();
17+
Action test_variable = ExampleActions.Test;
18+
test_variable();
1719

18-
Action<int> display_variable = ExampleActions.Display;
19-
display_variable(10);
20+
Action<int> display_variable = ExampleActions.Display;
21+
display_variable(10);
2022

21-
Action<int[]> display_array_variable = ExampleActions<int>.DisplayArray;
22-
display_array_variable(new int[] { 10, 20, 30 });
23+
Action<int[]> display_array_variable =
24+
ExampleActions<int>.DisplayArray;
25+
display_array_variable(new int[] { 10, 20, 30 });
2326

24-
// Passing an action as an argument:
25-
CallingAction.Demo(ExampleActions.Test);
26-
CallingAction.DemoT(ExampleActions.Display);
27+
// Passing an action as an argument:
28+
CallingAction.Demo(ExampleActions.Test);
29+
CallingAction.DemoT(ExampleActions.Display);
2730

28-
// Done passing an action.
29-
}
30-
}
31+
// Done passing an action.
32+
}
33+
}

source/code/projects/Dictionary_chaining/Dictionary/Address.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
// values, even complex ones.
44
public class Address
55
{
6-
public string Street { get; set; }
6+
public string Street { get; set; }
77

8-
public Address(string streetP)
9-
{
10-
Street = streetP;
11-
}
8+
public Address(string streetP)
9+
{
10+
Street = streetP;
11+
}
1212

13-
public override string ToString()
14-
{
15-
return Street;
16-
}
13+
public override string ToString()
14+
{
15+
return Street;
16+
}
1717
}

0 commit comments

Comments
 (0)