Skip to content

Commit 865e607

Browse files
author
Ron Petrusha
authored
Revisions for Reiwa era (#772)
* Revisions for Reiwa era * Revised exmaples in mref * Addressed review comments
1 parent b964b41 commit 865e607

File tree

13 files changed

+153
-284
lines changed

13 files changed

+153
-284
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11

2-
// The following code example calls GetMonthsInYear for 5 years in each era.
3-
// <snippet1>
42
using namespace System;
53
using namespace System::Globalization;
4+
65
int main()
76
{
8-
97
// Creates and initializes a JapaneseCalendar.
108
JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
119

@@ -28,19 +26,5 @@ int main()
2826
for ( int y = 1; y <= 5; y++ )
2927
Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) );
3028
Console::WriteLine();
31-
3229
}
3330
}
34-
35-
/*
36-
This code produces the following output.
37-
38-
YEAR 1 2 3 4 5
39-
CurrentEra: 12 12 12 12 12
40-
Era 4: 12 12 12 12 12
41-
Era 3: 12 12 12 12 12
42-
Era 2: 12 12 12 12 12
43-
Era 1: 12 12 12 12 12
44-
45-
*/
46-
// </snippet1>

snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11

2-
// The following code example calls IsLeapDay for the last day of the second
3-
// month (February) for five years in each of the eras.
4-
// <snippet1>
52
using namespace System;
63
using namespace System::Globalization;
4+
75
int main()
86
{
9-
107
// Creates and initializes a JapaneseCalendar.
118
JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
129

@@ -37,22 +34,19 @@ int main()
3734
{
3835
iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] );
3936
Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) );
40-
4137
}
4238
Console::WriteLine();
43-
4439
}
4540
}
46-
4741
/*
4842
This code produces the following output.
4943
5044
YEAR 1 2 3 4 5
51-
CurrentEra: False False False True False
45+
CurrentEra: False True False False False
46+
Era 5: False True False False False
5247
Era 4: False False False True False
5348
Era 3: False False True False False
5449
Era 2: True False False False True
5550
Era 1: True False False False True
5651
5752
*/
58-
// </snippet1>

snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
2-
// The following code example calls IsLeapYear for five years in each of the eras.
3-
// <snippet1>
41
using namespace System;
52
using namespace System::Globalization;
3+
64
int main()
7-
{
8-
5+
{
96
// Creates and initializes a JapaneseCalendar.
107
JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
118

@@ -28,19 +25,17 @@ int main()
2825
for ( int y = 1; y <= 5; y++ )
2926
Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) );
3027
Console::WriteLine();
31-
3228
}
3329
}
34-
3530
/*
3631
This code produces the following output.
3732
3833
YEAR 1 2 3 4 5
39-
CurrentEra: False False False True False
34+
CurrentEra: False True False False False
35+
Era 5: False True False False False
4036
Era 4: False False False True False
4137
Era 3: False False True False False
4238
Era 2: True False False False True
4339
Era 1: True False False False True
4440
4541
*/
46-
// </snippet1>

snippets/csharp/VS_Snippets_CLR/conceptual.calendars/cs/instantiatewithera1.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// <Snippet7>
21
using System;
32
using System.Globalization;
43

@@ -26,13 +25,3 @@ public static void Main()
2625
}
2726
}
2827
}
29-
// The example displays the following output:
30-
// Date instantiated without an era:
31-
// 1/1/2 in Japanese Calendar -> 1/1/1990 in Gregorian
32-
//
33-
// Dates instantiated with eras:
34-
// 1/1/2 era 4 in Japanese Calendar -> 1/1/1990 in Gregorian
35-
// 1/1/2 era 3 in Japanese Calendar -> 1/1/1927 in Gregorian
36-
// 1/1/2 era 2 in Japanese Calendar -> 1/1/1913 in Gregorian
37-
// 1/1/2 era 1 in Japanese Calendar -> 1/1/1869 in Gregorian
38-
// </Snippet7>
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
// The following code example calls GetMonthsInYear for 5 years in each era.
2-
3-
// <snippet1>
41
using System;
52
using System.Globalization;
63

7-
84
public class SamplesJapaneseCalendar {
95

106
public static void Main() {
@@ -13,38 +9,23 @@ public static void Main() {
139
JapaneseCalendar myCal = new JapaneseCalendar();
1410

1511
// Displays the header.
16-
Console.Write( "YEAR\t" );
17-
for ( int y = 1; y <= 5; y++ )
18-
Console.Write( "\t{0}", y );
12+
Console.Write("YEAR\t");
13+
for (int y = 1; y <= 5; y++ )
14+
Console.Write($"\t{y}");
1915
Console.WriteLine();
2016

2117
// Displays the value of the CurrentEra property.
22-
Console.Write( "CurrentEra:" );
23-
for ( int y = 1; y <= 5; y++ )
24-
Console.Write( "\t{0}", myCal.GetMonthsInYear( y, JapaneseCalendar.CurrentEra ) );
18+
Console.Write("CurrentEra:");
19+
for (int y = 1; y <= 5; y++ )
20+
Console.Write($"\t{myCal.GetMonthsInYear(y, JapaneseCalendar.CurrentEra)}");
2521
Console.WriteLine();
2622

2723
// Displays the values in the Eras property.
28-
for ( int i = 0; i < myCal.Eras.Length; i++ ) {
29-
Console.Write( "Era {0}:\t", myCal.Eras[i] );
30-
for ( int y = 1; y <= 5; y++ )
31-
Console.Write( "\t{0}", myCal.GetMonthsInYear( y, myCal.Eras[i] ) );
24+
for (int i = 0; i < myCal.Eras.Length; i++ ) {
25+
Console.Write($"Era {myCal.Eras[i]}:\t");
26+
for (int y = 1; y <= 5; y++ )
27+
Console.Write("\t{myCal.GetMonthsInYear(y, myCal.Eras[i])}");
3228
Console.WriteLine();
3329
}
34-
3530
}
36-
3731
}
38-
39-
/*
40-
This code produces the following output.
41-
42-
YEAR 1 2 3 4 5
43-
CurrentEra: 12 12 12 12 12
44-
Era 4: 12 12 12 12 12
45-
Era 3: 12 12 12 12 12
46-
Era 2: 12 12 12 12 12
47-
Era 1: 12 12 12 12 12
48-
49-
*/
50-
// </snippet1>

snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CS/japanesecalendar_isleapday.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
// The following code example calls IsLeapDay for the last day of the second month (February) for five years in each of the eras.
2-
3-
// <snippet1>
41
using System;
52
using System.Globalization;
63

7-
8-
public class SamplesJapaneseCalendar {
9-
10-
public static void Main() {
11-
4+
public class SamplesJapaneseCalendar
5+
{
6+
public static void Main()
7+
{
128
// Creates and initializes a JapaneseCalendar.
139
JapaneseCalendar myCal = new JapaneseCalendar();
1410

@@ -38,20 +34,17 @@ public static void Main() {
3834
}
3935
Console.WriteLine();
4036
}
41-
4237
}
43-
4438
}
45-
4639
/*
4740
This code produces the following output.
4841
4942
YEAR 1 2 3 4 5
50-
CurrentEra: False False False True False
43+
CurrentEra: False True False False False
44+
Era 5: False True False False False
5145
Era 4: False False False True False
5246
Era 3: False False True False False
5347
Era 2: True False False False True
5448
Era 1: True False False False True
5549
5650
*/
57-
// </snippet1>

snippets/csharp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CS/japanesecalendar_isleapyear.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
// The following code example calls IsLeapYear for five years in each of the eras.
2-
3-
// <snippet1>
41
using System;
52
using System.Globalization;
63

7-
8-
public class SamplesJapaneseCalendar {
9-
10-
public static void Main() {
11-
4+
public class SamplesJapaneseCalendar
5+
{
6+
public static void Main()
7+
{
128
// Creates and initializes a JapaneseCalendar.
139
JapaneseCalendar myCal = new JapaneseCalendar();
1410

@@ -31,20 +27,17 @@ public static void Main() {
3127
Console.Write( "\t{0}", myCal.IsLeapYear( y, myCal.Eras[i] ) );
3228
Console.WriteLine();
3329
}
34-
3530
}
36-
3731
}
38-
3932
/*
4033
This code produces the following output.
4134
4235
YEAR 1 2 3 4 5
43-
CurrentEra: False False False True False
36+
CurrentEra: False True False False False
37+
Era 5: False True False False False
4438
Era 4: False False False True False
4539
Era 3: False False True False False
4640
Era 2: True False False False True
4741
Era 1: True False False False True
4842
4943
*/
50-
// </snippet1>

snippets/standard/datetime/calendars/current-era/cs/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ public static void Main()
1515

1616

1717
}
18-
}
18+
}

snippets/standard/datetime/calendars/current-era/vb/Program.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Public Module Example
1010
Console.WriteLine($"Gregorian calendar dat: {dat:d}")
1111
Console.WriteLine($"Japanese calendar dat: {dat.ToString("d", jaJp)}")
1212
End Sub
13-
End Module
13+
End Module

snippets/visualbasic/VS_Snippets_CLR/conceptual.calendars/vb/instantiatewithera1.vb

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
' Visual Basic .NET Document
2-
Option Strict On
3-
4-
' <Snippet7>
51
Imports System.Globalization
62

73
Module Example
@@ -27,13 +23,4 @@ Module Example
2723
Next
2824
End Sub
2925
End Module
30-
' The example displays the following output:
31-
' Date instantiated without an era:
32-
' 1/1/2 in Japanese Calendar -> 1/1/1990 in Gregorian
33-
'
34-
' Dates instantiated with eras:
35-
' 1/1/2 era 4 in Japanese Calendar -> 1/1/1990 in Gregorian
36-
' 1/1/2 era 3 in Japanese Calendar -> 1/1/1927 in Gregorian
37-
' 1/1/2 era 2 in Japanese Calendar -> 1/1/1913 in Gregorian
38-
' 1/1/2 era 1 in Japanese Calendar -> 1/1/1869 in Gregorian
39-
' </Snippet7>
26+

0 commit comments

Comments
 (0)