diff --git a/src/PhoneNumbers/CountryInfo.cs b/src/PhoneNumbers/CountryInfo.cs index 10982a97..2a5b5daa 100644 --- a/src/PhoneNumbers/CountryInfo.cs +++ b/src/PhoneNumbers/CountryInfo.cs @@ -18,7 +18,10 @@ public sealed partial class CountryInfo internal const string NorthAmerica = "North America"; internal const string Oceania = "Oceania"; internal const string SouthAmerica = "South America"; + #if !NET8_0_OR_GREATER private static readonly ReadOnlyCollection s_emptyIntArray = new(Array.Empty()); + #endif + private static readonly ReadOnlyCollection s_formatters = new( [ E164PhoneNumberFormatter.Instance, @@ -96,12 +99,22 @@ internal CountryInfo() /// /// Gets the possible lengths of the national destination code. /// - internal ReadOnlyCollection NdcLengths { get; init; } = s_emptyIntArray; + internal ReadOnlyCollection NdcLengths { get; init; } = + #if NET8_0_OR_GREATER + ReadOnlyCollection.Empty; + #else + s_emptyIntArray; + #endif /// /// Gets the permitted lengths of the national significant number. /// - internal ReadOnlyCollection NsnLengths { get; init; } = s_emptyIntArray; + internal ReadOnlyCollection NsnLengths { get; init; } = + #if NET8_0_OR_GREATER + ReadOnlyCollection.Empty; + #else + s_emptyIntArray; + #endif internal static IEnumerable GetCountries() => typeof(CountryInfo)