Skip to content

Commit 9ad2c78

Browse files
Fixed indentation in code snippet. (dotnet#8218)
1 parent 0470060 commit 9ad2c78

File tree

1 file changed

+63
-63
lines changed
  • snippets/csharp/System/DateTime/Kind

1 file changed

+63
-63
lines changed

snippets/csharp/System/DateTime/Kind/ks.cs

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -9,90 +9,90 @@ class Sample
99
{
1010
public static void Main()
1111
{
12-
// Get the date and time for the current moment, adjusted
13-
// to the local time zone.
12+
// Get the date and time for the current moment, adjusted
13+
// to the local time zone.
1414

15-
DateTime saveNow = DateTime.Now;
15+
DateTime saveNow = DateTime.Now;
1616

17-
// Get the date and time for the current moment expressed
18-
// as coordinated universal time (UTC).
17+
// Get the date and time for the current moment expressed
18+
// as coordinated universal time (UTC).
1919

20-
DateTime saveUtcNow = DateTime.UtcNow;
21-
DateTime myDt;
20+
DateTime saveUtcNow = DateTime.UtcNow;
21+
DateTime myDt;
2222

23-
// Display the value and Kind property of the current moment
24-
// expressed as UTC and local time.
23+
// Display the value and Kind property of the current moment
24+
// expressed as UTC and local time.
2525

26-
DisplayNow("UtcNow: ..........", saveUtcNow);
27-
DisplayNow("Now: .............", saveNow);
28-
Console.WriteLine();
26+
DisplayNow("UtcNow: ..........", saveUtcNow);
27+
DisplayNow("Now: .............", saveNow);
28+
Console.WriteLine();
2929

30-
// Change the Kind property of the current moment to
31-
// DateTimeKind.Utc and display the result.
30+
// Change the Kind property of the current moment to
31+
// DateTimeKind.Utc and display the result.
3232

33-
myDt = DateTime.SpecifyKind(saveNow, DateTimeKind.Utc);
34-
Display("Utc: .............", myDt);
33+
myDt = DateTime.SpecifyKind(saveNow, DateTimeKind.Utc);
34+
Display("Utc: .............", myDt);
3535

36-
// Change the Kind property of the current moment to
37-
// DateTimeKind.Local and display the result.
36+
// Change the Kind property of the current moment to
37+
// DateTimeKind.Local and display the result.
3838

39-
myDt = DateTime.SpecifyKind(saveNow, DateTimeKind.Local);
40-
Display("Local: ...........", myDt);
39+
myDt = DateTime.SpecifyKind(saveNow, DateTimeKind.Local);
40+
Display("Local: ...........", myDt);
4141

42-
// Change the Kind property of the current moment to
43-
// DateTimeKind.Unspecified and display the result.
42+
// Change the Kind property of the current moment to
43+
// DateTimeKind.Unspecified and display the result.
4444

45-
myDt = DateTime.SpecifyKind(saveNow, DateTimeKind.Unspecified);
46-
Display("Unspecified: .....", myDt);
45+
myDt = DateTime.SpecifyKind(saveNow, DateTimeKind.Unspecified);
46+
Display("Unspecified: .....", myDt);
4747
}
4848

49-
// Display the value and Kind property of a DateTime structure, the
50-
// DateTime structure converted to local time, and the DateTime
51-
// structure converted to universal time.
49+
// Display the value and Kind property of a DateTime structure, the
50+
// DateTime structure converted to local time, and the DateTime
51+
// structure converted to universal time.
5252

5353
public static string datePatt = @"M/d/yyyy hh:mm:ss tt";
5454
public static void Display(string title, DateTime inputDt)
5555
{
56-
DateTime dispDt = inputDt;
57-
string dtString;
58-
59-
// Display the original DateTime.
60-
61-
dtString = dispDt.ToString(datePatt);
62-
Console.WriteLine("{0} {1}, Kind = {2}",
63-
title, dtString, dispDt.Kind);
64-
65-
// Convert inputDt to local time and display the result.
66-
// If inputDt.Kind is DateTimeKind.Utc, the conversion is performed.
67-
// If inputDt.Kind is DateTimeKind.Local, the conversion is not performed.
68-
// If inputDt.Kind is DateTimeKind.Unspecified, the conversion is
69-
// performed as if inputDt was universal time.
70-
71-
dispDt = inputDt.ToLocalTime();
72-
dtString = dispDt.ToString(datePatt);
73-
Console.WriteLine(" ToLocalTime: {0}, Kind = {1}",
74-
dtString, dispDt.Kind);
75-
76-
// Convert inputDt to universal time and display the result.
77-
// If inputDt.Kind is DateTimeKind.Utc, the conversion is not performed.
78-
// If inputDt.Kind is DateTimeKind.Local, the conversion is performed.
79-
// If inputDt.Kind is DateTimeKind.Unspecified, the conversion is
80-
// performed as if inputDt was local time.
81-
82-
dispDt = inputDt.ToUniversalTime();
83-
dtString = dispDt.ToString(datePatt);
84-
Console.WriteLine(" ToUniversalTime: {0}, Kind = {1}",
85-
dtString, dispDt.Kind);
86-
Console.WriteLine();
56+
DateTime dispDt = inputDt;
57+
string dtString;
58+
59+
// Display the original DateTime.
60+
61+
dtString = dispDt.ToString(datePatt);
62+
Console.WriteLine("{0} {1}, Kind = {2}",
63+
title, dtString, dispDt.Kind);
64+
65+
// Convert inputDt to local time and display the result.
66+
// If inputDt.Kind is DateTimeKind.Utc, the conversion is performed.
67+
// If inputDt.Kind is DateTimeKind.Local, the conversion is not performed.
68+
// If inputDt.Kind is DateTimeKind.Unspecified, the conversion is
69+
// performed as if inputDt was universal time.
70+
71+
dispDt = inputDt.ToLocalTime();
72+
dtString = dispDt.ToString(datePatt);
73+
Console.WriteLine(" ToLocalTime: {0}, Kind = {1}",
74+
dtString, dispDt.Kind);
75+
76+
// Convert inputDt to universal time and display the result.
77+
// If inputDt.Kind is DateTimeKind.Utc, the conversion is not performed.
78+
// If inputDt.Kind is DateTimeKind.Local, the conversion is performed.
79+
// If inputDt.Kind is DateTimeKind.Unspecified, the conversion is
80+
// performed as if inputDt was local time.
81+
82+
dispDt = inputDt.ToUniversalTime();
83+
dtString = dispDt.ToString(datePatt);
84+
Console.WriteLine(" ToUniversalTime: {0}, Kind = {1}",
85+
dtString, dispDt.Kind);
86+
Console.WriteLine();
8787
}
8888

89-
// Display the value and Kind property for DateTime.Now and DateTime.UtcNow.
89+
// Display the value and Kind property for DateTime.Now and DateTime.UtcNow.
9090

9191
public static void DisplayNow(string title, DateTime inputDt)
9292
{
93-
string dtString = inputDt.ToString(datePatt);
94-
Console.WriteLine("{0} {1}, Kind = {2}",
95-
title, dtString, inputDt.Kind);
93+
string dtString = inputDt.ToString(datePatt);
94+
Console.WriteLine("{0} {1}, Kind = {2}",
95+
title, dtString, inputDt.Kind);
9696
}
9797
}
9898

@@ -115,4 +115,4 @@ public static void DisplayNow(string title, DateTime inputDt)
115115
ToUniversalTime: 5/6/2005 09:34:42 PM, Kind = Utc
116116
117117
*/
118-
//</snippet1>
118+
//</snippet1>

0 commit comments

Comments
 (0)