1- using System ;
1+ // <Snippet3>
2+ using System ;
23using System . Globalization ;
34
45public class ToStringExample3
56{
67 public static void Main ( )
78 {
8- // <Snippet3>
99 CultureInfo [ ] cultures = [
1010 CultureInfo . InvariantCulture ,
1111 new CultureInfo ( "en-us" ) ,
@@ -20,21 +20,22 @@ public static void Main()
2020 foreach ( CultureInfo culture in cultures )
2121 {
2222 string cultureName ;
23+
2324 if ( string . IsNullOrEmpty ( culture . Name ) )
2425 cultureName = culture . NativeName ;
2526 else
2627 cultureName = culture . Name ;
2728
2829 Console . WriteLine ( $ "In { cultureName } , { thisDate . ToString ( culture ) } ") ;
2930 }
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>
3931 }
4032}
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