mirror of
https://github.com/CommunityToolkit/dotnet.git
synced 2026-10-19 21:56:59 +08:00
Implemented changes based on Sergio's review comments.
This commit is contained in:
@@ -645,6 +645,39 @@ namespace Microsoft.Toolkit.Diagnostics
|
||||
throw new NotSupportedException(message, innerException);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws a new <see cref="NullReferenceException"/>.
|
||||
/// </summary>
|
||||
/// <exception cref="NullReferenceException">Thrown with no parameters.</exception>
|
||||
[DoesNotReturn]
|
||||
public static void ThrowNullReferenceException()
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws a new <see cref="NullReferenceException"/>.
|
||||
/// </summary>
|
||||
/// <param name="message">The message to include in the exception.</param>
|
||||
/// <exception cref="NullReferenceException">Thrown with the specified parameter.</exception>
|
||||
[DoesNotReturn]
|
||||
public static void ThrowNullReferenceException(string? message)
|
||||
{
|
||||
throw new NullReferenceException(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws a new <see cref="NullReferenceException"/>.
|
||||
/// </summary>
|
||||
/// <param name="message">The message to include in the exception.</param>
|
||||
/// <param name="innerException">The inner <see cref="Exception"/> to include.</param>
|
||||
/// <exception cref="NullReferenceException">Thrown with the specified parameter.</exception>
|
||||
[DoesNotReturn]
|
||||
public static void ThrowNullReferenceException(string? message, Exception? innerException)
|
||||
{
|
||||
throw new NullReferenceException(message, innerException);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws a new <see cref="ObjectDisposedException"/>.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Toolkit
|
||||
{
|
||||
/// <summary>
|
||||
/// Class containing some constants
|
||||
/// represented as Floating point numbers.
|
||||
/// </summary>
|
||||
public static class Scalar
|
||||
{
|
||||
// Pi related floating point constants
|
||||
|
||||
/// <summary>
|
||||
/// (float)Math.PI radians ( or 180 degrees).
|
||||
/// </summary>
|
||||
public const float Pi = (float)Math.PI;
|
||||
|
||||
/// <summary>
|
||||
/// Two times (float)Math.PI radians ( or 360 degrees).
|
||||
/// </summary>
|
||||
public const float TwoPi = 2f * Pi;
|
||||
|
||||
/// <summary>
|
||||
/// Half of (float)Math.PI radians ( or 90 degrees).
|
||||
/// </summary>
|
||||
public const float PiByTwo = Pi / 2f;
|
||||
|
||||
/// <summary>
|
||||
/// One third of (float)Math.PI radians ( or 60 degrees).
|
||||
/// </summary>
|
||||
public const float PiByThree = Pi / 3f;
|
||||
|
||||
/// <summary>
|
||||
/// One fourth of (float)Math.PI radians ( or 45 degrees).
|
||||
/// </summary>
|
||||
public const float PiByFour = Pi / 4f;
|
||||
|
||||
/// <summary>
|
||||
/// One sixth of (float)Math.PI radians ( or 30 degrees).
|
||||
/// </summary>
|
||||
public const float PiBySix = Pi / 6f;
|
||||
|
||||
/// <summary>
|
||||
/// Three times half of (float)Math.PI radians ( or 270 degrees).
|
||||
/// </summary>
|
||||
public const float ThreePiByTwo = 3f * Pi / 2f;
|
||||
|
||||
// Conversion constants
|
||||
|
||||
/// <summary>
|
||||
/// 1 degree in radians.
|
||||
/// </summary>
|
||||
public const float DegreesToRadians = Pi / 180f;
|
||||
|
||||
/// <summary>
|
||||
/// 1 radian in degrees.
|
||||
/// </summary>
|
||||
public const float RadiansToDegrees = 180f / Pi;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user