diff --git a/src/System.Private.CoreLib/shared/System/Globalization/Calendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/Calendar.cs
index b863cf5a7b62..c54e55822225 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/Calendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/Calendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using System.Diagnostics;
using System.Runtime.Serialization;
@@ -322,7 +323,7 @@ public virtual int GetDaysInYear(int year)
/// Get the list of era values.
///
/// The int array of the era names supported in this calendar or null if era is not used.
- public abstract int[] Eras { get; }
+ public abstract int[]? Eras { get; }
// Returns the hour part of the specified DateTime. The returned value is an
// integer between 0 and 23.
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/CalendricalCalculationsHelper.cs b/src/System.Private.CoreLib/shared/System/Globalization/CalendricalCalculationsHelper.cs
index 241019a0bc31..a0fb75978a4f 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/CalendricalCalculationsHelper.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/CalendricalCalculationsHelper.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using System.Diagnostics;
namespace System.Globalization
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/CharUnicodeInfo.cs b/src/System.Private.CoreLib/shared/System/Globalization/CharUnicodeInfo.cs
index e627cc7483fd..a78965b3e23b 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/CharUnicodeInfo.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/CharUnicodeInfo.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using System.Buffers.Binary;
using System.Diagnostics;
using System.Text;
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/CharUnicodeInfoData.cs b/src/System.Private.CoreLib/shared/System/Globalization/CharUnicodeInfoData.cs
index 95aac2f35576..1af4cfeb56cd 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/CharUnicodeInfoData.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/CharUnicodeInfoData.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
public static partial class CharUnicodeInfo
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/ChineseLunisolarCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/ChineseLunisolarCalendar.cs
index 56ce99550faf..ef68ce21b763 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/ChineseLunisolarCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/ChineseLunisolarCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
///
@@ -255,7 +256,7 @@ protected override int DaysInYearBeforeMinSupportedYear
internal override DateTime MaxDate => s_maxDate;
- internal override EraInfo[] CalEraInfo => null;
+ internal override EraInfo[]? CalEraInfo => null;
internal override int GetYearInfo(int lunarYear, int index)
{
@@ -307,6 +308,6 @@ internal override CalendarId BaseCalendarID
}
}
- public override int[] Eras => new int[] { ChineseEra };
+ public override int[]? Eras => new int[] { ChineseEra };
}
}
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/EastAsianLunisolarCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/EastAsianLunisolarCalendar.cs
index d1ca0f8d74ba..aa7d1fb0a35b 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/EastAsianLunisolarCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/EastAsianLunisolarCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
public abstract class EastAsianLunisolarCalendar : Calendar
@@ -69,7 +70,7 @@ public int GetTerrestrialBranch(int sexagenaryYear)
internal abstract int MinCalendarYear { get; }
internal abstract int MaxCalendarYear { get; }
- internal abstract EraInfo[] CalEraInfo { get; }
+ internal abstract EraInfo[]? CalEraInfo { get; }
internal abstract DateTime MinDate { get; }
internal abstract DateTime MaxDate { get; }
@@ -78,7 +79,7 @@ public int GetTerrestrialBranch(int sexagenaryYear)
internal int MinEraCalendarYear(int era)
{
- EraInfo[] eraInfo = CalEraInfo;
+ EraInfo[]? eraInfo = CalEraInfo;
if (eraInfo == null)
{
return MinCalendarYear;
@@ -108,7 +109,7 @@ internal int MinEraCalendarYear(int era)
internal int MaxEraCalendarYear(int era)
{
- EraInfo[] eraInfo = CalEraInfo;
+ EraInfo[]? eraInfo = CalEraInfo;
if (eraInfo == null)
{
return MaxCalendarYear;
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/GregorianCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/GregorianCalendar.cs
index ebc5a54f4025..28bf46e5dd26 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/GregorianCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/GregorianCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
///
@@ -267,7 +268,7 @@ public override int GetDaysInYear(int year, int era)
public override int GetEra(DateTime time) => ADEra;
- public override int[] Eras => new int[] { ADEra };
+ public override int[]? Eras => new int[] { ADEra };
///
/// Returns the month part of the specified DateTime.
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/HebrewCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/HebrewCalendar.cs
index 67b3966e4e24..497536629d26 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/HebrewCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/HebrewCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using System.Diagnostics;
namespace System.Globalization
@@ -695,7 +696,7 @@ public override int GetDaysInYear(int year, int era)
public override int GetEra(DateTime time) => HebrewEra;
- public override int[] Eras => new int[] { HebrewEra };
+ public override int[]? Eras => new int[] { HebrewEra };
public override int GetMonth(DateTime time)
{
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.Unix.cs b/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.Unix.cs
index a6e8f73d3e44..2b7b35f2ea79 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.Unix.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.Unix.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
public partial class HijriCalendar : Calendar
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.Win32.cs b/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.Win32.cs
index 671a882412aa..d0b645ec1c35 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.Win32.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.Win32.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using Internal.Win32;
namespace System.Globalization
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.WinRT.cs b/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.WinRT.cs
index fb91c27ef62a..85b9afef3051 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.WinRT.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.WinRT.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using Internal.Runtime.Augments;
namespace System.Globalization
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.cs
index 71cdb346fda5..f2a8aff2523e 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/HijriCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
///
@@ -353,7 +354,7 @@ public override int GetEra(DateTime time)
return HijriEra;
}
- public override int[] Eras => new int[] { HijriEra };
+ public override int[]? Eras => new int[] { HijriEra };
public override int GetMonth(DateTime time)
{
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.Unix.cs b/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.Unix.cs
index ef781666ca87..84bcedb2c81b 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.Unix.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.Unix.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using System.Collections.Generic;
using System.Diagnostics;
@@ -9,7 +10,7 @@ namespace System.Globalization
{
public partial class JapaneseCalendar : Calendar
{
- private static EraInfo[] GetJapaneseEras()
+ private static EraInfo[]? GetJapaneseEras()
{
if (GlobalizationMode.Invariant)
{
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.Win32.cs b/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.Win32.cs
index 1a8ba7c44bb9..55c2c674691c 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.Win32.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.Win32.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using System.Diagnostics;
using Internal.Win32;
@@ -27,11 +28,11 @@ public partial class JapaneseCalendar : Calendar
// . is a delimiter, but the value of . doesn't matter.
// '_' marks the space between the japanese era name, japanese abbreviated era name
// english name, and abbreviated english names.
- private static EraInfo[] GetJapaneseEras()
+ private static EraInfo[]? GetJapaneseEras()
{
// Look in the registry key and see if we can find any ranges
int iFoundEras = 0;
- EraInfo[] registryEraRanges = null;
+ EraInfo[]? registryEraRanges = null;
try
{
@@ -51,7 +52,7 @@ private static EraInfo[] GetJapaneseEras()
for (int i = 0; i < valueNames.Length; i++)
{
// See if the era is a valid date
- EraInfo era = GetEraFromValue(valueNames[i], key.GetValue(valueNames[i]).ToString());
+ EraInfo? era = GetEraFromValue(valueNames[i], key.GetValue(valueNames[i]).ToString());
// continue if not valid
if (era == null) continue;
@@ -143,7 +144,7 @@ private static int CompareEraRanges(EraInfo a, EraInfo b)
// . is a delimiter, but the value of . doesn't matter.
// '_' marks the space between the japanese era name, japanese abbreviated era name
// english name, and abbreviated english names.
- private static EraInfo GetEraFromValue(string value, string data)
+ private static EraInfo? GetEraFromValue(string? value, string? data)
{
// Need inputs
if (value == null || data == null) return null;
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.WinRT.cs b/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.WinRT.cs
index 633baa4c7093..993a5cd0df9b 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.WinRT.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.WinRT.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using System.Diagnostics;
using Internal.Runtime.Augments;
@@ -10,7 +11,7 @@ namespace System.Globalization
{
public partial class JapaneseCalendar : Calendar
{
- private static EraInfo[] GetJapaneseEras()
+ private static EraInfo[]? GetJapaneseEras()
{
int erasCount = WinRTInterop.Callbacks.GetJapaneseEraCount();
if (erasCount < 4)
@@ -25,8 +26,8 @@ private static EraInfo[] GetJapaneseEras()
{
DateTimeOffset dateOffset;
- string eraName;
- string abbreviatedEraName;
+ string? eraName;
+ string? abbreviatedEraName;
if (!GetJapaneseEraInfo(i, out dateOffset, out eraName, out abbreviatedEraName))
{
@@ -36,7 +37,7 @@ private static EraInfo[] GetJapaneseEras()
DateTime dt = new DateTime(dateOffset.Ticks);
eras[erasCount - i] = new EraInfo(i, dt.Year, dt.Month, dt.Day, dt.Year - 1, 1, lastMaxYear - dt.Year + 1,
- eraName, abbreviatedEraName, GetJapaneseEnglishEraName(i)); // era #4 start year/month/day, yearOffset, minEraYear
+ eraName!, abbreviatedEraName!, GetJapaneseEnglishEraName(i)); // era #4 start year/month/day, yearOffset, minEraYear
lastMaxYear = dt.Year;
}
@@ -54,9 +55,9 @@ private static string GetJapaneseEnglishEraName(int era)
return era <= s_JapaneseErasEnglishNames.Length ? s_JapaneseErasEnglishNames[era - 1] : " ";
}
- private static bool GetJapaneseEraInfo(int era, out DateTimeOffset dateOffset, out string eraName, out string abbreviatedEraName)
+ private static bool GetJapaneseEraInfo(int era, out DateTimeOffset dateOffset, out string? eraName, out string? abbreviatedEraName)
{
- return WinRTInterop.Callbacks.GetJapaneseEraInfo(era, out dateOffset, out eraName, out abbreviatedEraName);
+ return WinRTInterop.Callbacks.GetJapaneseEraInfo(era, out dateOffset, out eraName, out abbreviatedEraName);
}
}
}
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.cs
index bcddd191a87c..090d095559ac 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/JapaneseCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
///
@@ -43,7 +44,7 @@ public partial class JapaneseCalendar : Calendar
// Using a field initializer rather than a static constructor so that the whole class can be lazy
// init.
- private static volatile EraInfo[] s_japaneseEraInfo;
+ private static volatile EraInfo[]? s_japaneseEraInfo;
// m_EraInfo must be listed in reverse chronological order. The most recent era
// should be the first element.
@@ -68,24 +69,16 @@ public partial class JapaneseCalendar : Calendar
internal static EraInfo[] GetEraInfo()
{
// See if we need to build it
- if (s_japaneseEraInfo == null)
- {
- s_japaneseEraInfo = GetJapaneseEras();
-
+ return s_japaneseEraInfo ??
+ (s_japaneseEraInfo = GetJapaneseEras()) ??
// See if we have to use the built-in eras
- if (s_japaneseEraInfo == null)
+ (s_japaneseEraInfo = new EraInfo[]
{
- s_japaneseEraInfo = new EraInfo[]
- {
- new EraInfo(4, 1989, 1, 8, 1988, 1, GregorianCalendar.MaxYear - 1988, "\x5e73\x6210", "\x5e73", "H"),
- new EraInfo(3, 1926, 12, 25, 1925, 1, 1989 - 1925, "\x662d\x548c", "\x662d", "S"),
- new EraInfo(2, 1912, 7, 30, 1911, 1, 1926 - 1911, "\x5927\x6b63", "\x5927", "T"),
- new EraInfo(1, 1868, 1, 1, 1867, 1, 1912 - 1867, "\x660e\x6cbb", "\x660e", "M")
- };
- }
- }
-
- return s_japaneseEraInfo;
+ new EraInfo(4, 1989, 1, 8, 1988, 1, GregorianCalendar.MaxYear - 1988, "\x5e73\x6210", "\x5e73", "H"),
+ new EraInfo(3, 1926, 12, 25, 1925, 1, 1989 - 1925, "\x662d\x548c", "\x662d", "S"),
+ new EraInfo(2, 1912, 7, 30, 1911, 1, 1926 - 1911, "\x5927\x6b63", "\x5927", "T"),
+ new EraInfo(1, 1868, 1, 1, 1867, 1, 1912 - 1867, "\x660e\x6cbb", "\x660e", "M")
+ });
}
internal static volatile Calendar s_defaultInstance;
@@ -220,7 +213,7 @@ public override int ToFourDigitYear(int year)
}
- public override int[] Eras => _helper.Eras;
+ public override int[]? Eras => _helper.Eras;
///
/// Return the various era strings
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/JapaneseLunisolarCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/JapaneseLunisolarCalendar.cs
index cd69cb859dd1..db1fd4f5b532 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/JapaneseLunisolarCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/JapaneseLunisolarCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
///
@@ -142,7 +143,7 @@ protected override int DaysInYearBeforeMinSupportedYear
internal override DateTime MaxDate => s_maxDate;
- internal override EraInfo[] CalEraInfo => JapaneseCalendar.GetEraInfo();
+ internal override EraInfo[]? CalEraInfo => JapaneseCalendar.GetEraInfo();
internal override int GetYearInfo(int lunarYear, int index)
{
@@ -216,6 +217,6 @@ public JapaneseLunisolarCalendar()
internal override CalendarId ID => CalendarId.JAPANESELUNISOLAR;
- public override int[] Eras => _helper.Eras;
+ public override int[]? Eras => _helper.Eras;
}
}
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/JulianCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/JulianCalendar.cs
index bba7f07053a9..79a06251da57 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/JulianCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/JulianCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
///
@@ -266,7 +267,7 @@ public override int GetMonth(DateTime time)
return GetDatePart(time.Ticks, DatePartMonth);
}
- public override int[] Eras => new int[] { JulianEra };
+ public override int[]? Eras => new int[] { JulianEra };
public override int GetMonthsInYear(int year, int era)
{
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/KoreanCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/KoreanCalendar.cs
index 63c372e711c6..4fbaa9f69b91 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/KoreanCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/KoreanCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
///
@@ -63,7 +64,6 @@ public override DateTime AddMonths(DateTime time, int months)
return _helper.AddMonths(time, months);
}
-
public override DateTime AddYears(DateTime time, int years)
{
return _helper.AddYears(time, years);
@@ -139,14 +139,12 @@ public override bool IsLeapMonth(int year, int month, int era)
return _helper.IsLeapMonth(year, month, era);
}
-
public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
{
return _helper.ToDateTime(year, month, day, hour, minute, second, millisecond, era);
}
-
- public override int[] Eras => _helper.Eras;
+ public override int[]? Eras => _helper.Eras;
private const int DefaultTwoDigitYearMax = 4362;
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/KoreanLunisolarCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/KoreanLunisolarCalendar.cs
index aa90a83e46d0..b7feb1a33898 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/KoreanLunisolarCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/KoreanLunisolarCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
///
@@ -1184,7 +1185,7 @@ protected override int DaysInYearBeforeMinSupportedYear
internal override DateTime MaxDate => s_maxDate;
- internal override EraInfo[] CalEraInfo => null;
+ internal override EraInfo[]? CalEraInfo => null;
internal override int GetYearInfo(int lunarYear, int index)
{
@@ -1235,6 +1236,6 @@ public override int GetEra(DateTime time)
internal override CalendarId ID => CalendarId.KOREANLUNISOLAR;
- public override int[] Eras => new int[] { GregorianEra };
+ public override int[]? Eras => new int[] { GregorianEra };
}
}
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/PersianCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/PersianCalendar.cs
index 40f9c9c84616..0858379749cf 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/PersianCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/PersianCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using System.Diagnostics;
namespace System.Globalization
@@ -281,7 +282,7 @@ public override int GetEra(DateTime time)
return PersianEra;
}
- public override int[] Eras => new int[] { PersianEra };
+ public override int[]? Eras => new int[] { PersianEra };
public override int GetMonth(DateTime time)
{
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/TaiwanCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/TaiwanCalendar.cs
index f3414d383a5e..6d7fb4177ec8 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/TaiwanCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/TaiwanCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using System.Diagnostics.CodeAnalysis;
namespace System.Globalization
@@ -148,7 +149,7 @@ public override DateTime ToDateTime(int year, int month, int day, int hour, int
return _helper.ToDateTime(year, month, day, hour, minute, second, millisecond, era);
}
- public override int[] Eras => _helper.Eras;
+ public override int[]? Eras => _helper.Eras;
private const int DefaultTwoDigitYearMax = 99;
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/TaiwanLunisolarCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/TaiwanLunisolarCalendar.cs
index 4898e5941120..826f0f389c8b 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/TaiwanLunisolarCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/TaiwanLunisolarCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
///
@@ -198,7 +199,7 @@ protected override int DaysInYearBeforeMinSupportedYear
internal override DateTime MaxDate => s_maxDate;
- internal override EraInfo[] CalEraInfo => s_taiwanLunisolarEraInfo;
+ internal override EraInfo[]? CalEraInfo => s_taiwanLunisolarEraInfo;
internal override int GetYearInfo(int lunarYear, int index)
{
@@ -234,6 +235,6 @@ public TaiwanLunisolarCalendar()
internal override CalendarId ID => CalendarId.TAIWANLUNISOLAR;
- public override int[] Eras => _helper.Eras;
+ public override int[]? Eras => _helper.Eras;
}
}
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/ThaiBuddhistCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/ThaiBuddhistCalendar.cs
index 8bc48db3f952..1b39c7b2475f 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/ThaiBuddhistCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/ThaiBuddhistCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
namespace System.Globalization
{
///
@@ -124,7 +125,7 @@ public override DateTime ToDateTime(int year, int month, int day, int hour, int
return _helper.ToDateTime(year, month, day, hour, minute, second, millisecond, era);
}
- public override int[] Eras => _helper.Eras;
+ public override int[]? Eras => _helper.Eras;
private const int DefaultTwoDigitYearMax = 2572;
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/UmAlQuraCalendar.cs b/src/System.Private.CoreLib/shared/System/Globalization/UmAlQuraCalendar.cs
index 7b52e833e90a..8af839fd33f4 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/UmAlQuraCalendar.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/UmAlQuraCalendar.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+#nullable enable
using System.Diagnostics;
namespace System.Globalization
@@ -519,7 +520,7 @@ public override int GetEra(DateTime time)
return UmAlQuraEra;
}
- public override int[] Eras => new int[] { UmAlQuraEra };
+ public override int[]? Eras => new int[] { UmAlQuraEra };
public override int GetMonth(DateTime time)
{