/// <param name="destination">The destination span which contains the transformed characters.</param>
/// <param name="culture">An object that supplies culture-specific casing rules.</param>
/// <remarks>If the source and destinations overlap, this method behaves as if the original values are in
- /// a temporary location before the destination is overwritten.</remarks>
+ /// a temporary location before the destination is overwritten. If <paramref name="culture"/> is null, <see cref="System.Globalization.CultureInfo.CurrentCulture"/> will be used.</remarks>
/// <returns>The number of characters written into the destination span. If the destination is too small, returns -1.</returns>
- /// <exception cref="System.ArgumentNullException">
- /// Thrown when <paramref name="culture"/> is null.
- /// </exception>
- public static int ToLower(this ReadOnlySpan<char> source, Span<char> destination, CultureInfo culture)
+ public static int ToLower(this ReadOnlySpan<char> source, Span<char> destination, CultureInfo? culture)
{
if (culture == null)
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.culture);
+ culture = CultureInfo.CurrentCulture;
// Assuming that changing case does not affect length
if (destination.Length < source.Length)
if (GlobalizationMode.Invariant)
TextInfo.ToLowerAsciiInvariant(source, destination);
else
- culture!.TextInfo.ChangeCaseToLower(source, destination); // TODO-NULLABLE: Remove ! when [DoesNotReturn] respected
+ culture.TextInfo.ChangeCaseToLower(source, destination);
return source.Length;
}
/// <param name="destination">The destination span which contains the transformed characters.</param>
/// <param name="culture">An object that supplies culture-specific casing rules.</param>
/// <remarks>If the source and destinations overlap, this method behaves as if the original values are in
- /// a temporary location before the destination is overwritten.</remarks>
+ /// a temporary location before the destination is overwritten. If <paramref name="culture"/> is null, <see cref="System.Globalization.CultureInfo.CurrentCulture"/> will be used.</remarks>
/// <returns>The number of characters written into the destination span. If the destination is too small, returns -1.</returns>
- /// <exception cref="System.ArgumentNullException">
- /// Thrown when <paramref name="culture"/> is null.
- /// </exception>
- public static int ToUpper(this ReadOnlySpan<char> source, Span<char> destination, CultureInfo culture)
+ public static int ToUpper(this ReadOnlySpan<char> source, Span<char> destination, CultureInfo? culture)
{
if (culture == null)
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.culture);
+ culture = CultureInfo.CurrentCulture;
// Assuming that changing case does not affect length
if (destination.Length < source.Length)
if (GlobalizationMode.Invariant)
TextInfo.ToUpperAsciiInvariant(source, destination);
else
- culture!.TextInfo.ChangeCaseToUpper(source, destination); // TODO-NULLABLE: Remove ! when [DoesNotReturn] respected
+ culture.TextInfo.ChangeCaseToUpper(source, destination);
return source.Length;
}
_overlappedData = new OverlappedData(this);
}
- public Overlapped(int offsetLo, int offsetHi, IntPtr hEvent, IAsyncResult ar) : this()
+ public Overlapped(int offsetLo, int offsetHi, IntPtr hEvent, IAsyncResult? ar) : this()
{
Debug.Assert(_overlappedData != null, "Initialized in delegated ctor");
_overlappedData.OffsetLow = offsetLo;
}
[Obsolete("This constructor is not 64-bit compatible. Use the constructor that takes an IntPtr for the event handle. http://go.microsoft.com/fwlink/?linkid=14202")]
- public Overlapped(int offsetLo, int offsetHi, int hEvent, IAsyncResult ar) : this(offsetLo, offsetHi, new IntPtr(hEvent), ar)
+ public Overlapped(int offsetLo, int offsetHi, int hEvent, IAsyncResult? ar) : this(offsetLo, offsetHi, new IntPtr(hEvent), ar)
{
}