Skip to content

Commit 63713eb

Browse files
authored
[UUF] Fix bracket indentation (#10992)
1 parent 52b924a commit 63713eb

File tree

2 files changed

+33
-31
lines changed

2 files changed

+33
-31
lines changed

snippets/csharp/System/DateTime/ToString/ToString4.cs

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
1-
// <Snippet3>
2-
using System;
1+
using System;
32
using System.Globalization;
43

54
public class ToStringExample3
65
{
7-
public static void Main2()
8-
{
9-
CultureInfo[] cultures = new CultureInfo[] {CultureInfo.InvariantCulture,
10-
new CultureInfo("en-us"),
11-
new CultureInfo("fr-fr"),
12-
new CultureInfo("de-DE"),
13-
new CultureInfo("es-ES"),
14-
new CultureInfo("ja-JP")};
6+
public static void Main()
7+
{
8+
// <Snippet3>
9+
CultureInfo[] cultures = [
10+
CultureInfo.InvariantCulture,
11+
new CultureInfo("en-us"),
12+
new CultureInfo("fr-fr"),
13+
new CultureInfo("de-DE"),
14+
new CultureInfo("es-ES"),
15+
new CultureInfo("ja-JP")
16+
];
1517

16-
DateTime thisDate = new DateTime(2009, 5, 1, 9, 0, 0);
18+
DateTime thisDate = new(2025, 5, 1, 9, 0, 0);
1719

18-
foreach (CultureInfo culture in cultures)
19-
{
20-
string cultureName;
21-
if (string.IsNullOrEmpty(culture.Name))
22-
cultureName = culture.NativeName;
23-
else
24-
cultureName = culture.Name;
20+
foreach (CultureInfo culture in cultures)
21+
{
22+
string cultureName;
23+
if (string.IsNullOrEmpty(culture.Name))
24+
cultureName = culture.NativeName;
25+
else
26+
cultureName = culture.Name;
2527

26-
Console.WriteLine("In {0}, {1}",
27-
cultureName, thisDate.ToString(culture));
28-
}
29-
}
28+
Console.WriteLine($"In {cultureName}, {thisDate.ToString(culture)}");
29+
}
30+
31+
// The example produces the following output:
32+
// In Invariant Language (Invariant Country), 05/01/2009 09:00:00
33+
// In en-US, 5/1/2009 9:00:00 AM
34+
// In fr-FR, 01/05/2009 09:00:00
35+
// In de-DE, 01.05.2009 09:00:00
36+
// In es-ES, 01/05/2009 9:00:00
37+
// In ja-JP, 2009/05/01 9:00:00
38+
// </Snippet3>
39+
}
3040
}
31-
// The example produces the following output:
32-
// In Invariant Language (Invariant Country), 05/01/2009 09:00:00
33-
// In en-US, 5/1/2009 9:00:00 AM
34-
// In fr-FR, 01/05/2009 09:00:00
35-
// In de-DE, 01.05.2009 09:00:00
36-
// In es-ES, 01/05/2009 9:00:00
37-
// In ja-JP, 2009/05/01 9:00:00
38-
// </Snippet3>

snippets/csharp/System/DateTime/ToString/tostring.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<StartupObject>MainClass</StartupObject>
88
</PropertyGroup>

0 commit comments

Comments
 (0)