8000 Fixed identation (#7365) · dotnet/dotnet-api-docs@b378cd5 · GitHub
[go: up one dir, main page]

Skip to content

Commit b378cd5

Browse files
authored
Fixed identation (#7365)
1 parent b224e41 commit b378cd5

File tree

1 file changed

+29
-29
lines changed
  • samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.cancellationtokensource.class/cs

1 file changed

+29
-29
lines changed

samples/snippets/csharp/VS_Snippets_CLR_System/system.threading.cancellationtokensource.class/cs/cancel1.cs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,43 +20,43 @@ public static void Main()
2020
for (int taskCtr = 0; taskCtr <= 10; taskCtr++) {
2121
int iteration = taskCtr + 1;
2222
tasks.Add(factory.StartNew( () => {
23-
int value;
24-
int[] values = new int[10];
25-
for (int ctr = 1; ctr <= 10; ctr++) {
26-
lock (lockObj) {
27-
value = rnd.Next(0,101);
28-
}
29-
if (value == 0) {
30-
source.Cancel();
31-
Console.WriteLine("Cancelling at task {0}", iteration);
32-
break;
33-
}
34-
values[ctr-1] = value;
35-
}
36-
return values;
37-
}, token));
23+
int value;
24+
int[] values = new int[10];
25+
for (int ctr = 1; ctr <= 10; ctr++) {
26+
lock (lockObj) {
27+
value = rnd.Next(0,101);
28+
}
29+
if (value == 0) {
30+
source.Cancel();
31+
Console.WriteLine("Cancelling at task {0}", iteration);
32+
break;
33+
}
34+
values[ctr-1] = value;
35+
}
36+
return values;
37+
}, token));
3838
}
3939
try {
4040
Task<double> fTask = factory.ContinueWhenAll(tasks.ToArray(),
41-
(results) => {
42-
Console.WriteLine("Calculating overall mean...");
43-
long sum = 0;
44-
int n = 0;
45-
foreach (var t in results) {
46-
foreach (var r in t.Result) {
47-
sum += r;
48-
n++;
49-
}
50-
}
51-
return sum/(double) n;
52-
} , token);
41+
(results) => {
42+
Console.WriteLine("Calculating overall mean...");
43+
long sum = 0;
44+
int n = 0;
45+
foreach (var t in results) {
46+
foreach (var r in t.Result) {
47+
sum += r;
48+
n++;
49+
}
50+
}
51+
return sum/(double) n;
52+
} , token);
5353
Console.WriteLine("The mean is {0}.", fTask.Result);
5454
}
5555
catch (AggregateException ae) {
5656
foreach (Exception e in ae.InnerExceptions) {
5757
if (e is TaskCanceledException)
5858
Console.WriteLine("Unable to compute mean: {0}",
59-
((TaskCanceledException) e).Message);
59+
((TaskCanceledException) e).Message);
6060
else
6161
Console.WriteLine("Exception: " + e.GetType().Name);
6262
}
@@ -99,4 +99,4 @@ public static void Main()
9999
//
100100
// Calculating overall mean...
101101
// The mean is 4.86545454545455.
102-
// </Snippet1>
102+
// </Snippet1>

0 commit comments

Comments
 (0)
0