1
- using System ;
1
+ // <Snippet3>
2
+ using System ;
2
3
using System . Globalization ;
3
4
4
5
public class ToStringExample3
5
6
{
6
7
public static void Main ( )
7
8
{
8
- // <Snippet3>
9
9
CultureInfo [ ] cultures = [
10
10
CultureInfo . InvariantCulture ,
11
11
new CultureInfo ( "en-us" ) ,
@@ -20,21 +20,22 @@ public static void Main()
20
20
foreach ( CultureInfo culture in cultures )
21
21
{
22
22
string cultureName ;
23
+
23
24
if ( string . IsNullOrEmpty ( culture . Name ) )
24
25
cultureName = culture . NativeName ;
25
26
else
26
27
cultureName = culture . Name ;
27
28
28
29
Console . WriteLine ( $ "In { cultureName } , { thisDate . ToString ( culture ) } ") ;
29
30
}
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
31
}
40
32
}
33
+
34
+ // The example produces the following output:
35
+ // In Invariant Language (Invariant Country), 05/01/2009 09:00:00
36
+ // In en-US, 5/1/2009 9:00:00 AM
37
+ // In fr-FR, 01/05/2009 09:00:00
38
+ // In de-DE, 01.05.2009 09:00:00
39
+ // In es-ES, 01/05/2009 9:00:00
40
+ // In ja-JP, 2009/05/01 9:00:00
41
+ // </Snippet3>
0 commit comments