From bdf52bdfd2b2e9da0d23d902865ecfe3b3551071 Mon Sep 17 00:00:00 2001 From: Ratish Philip Date: Sun, 17 Jan 2021 11:13:51 -0800 Subject: [PATCH] Implemented changes based on Sergio's review comments. --- Microsoft.Toolkit/Diagnostics/ThrowHelper.cs | 33 ++++++++++ Microsoft.Toolkit/Scalar.cs | 64 -------------------- 2 files changed, 33 insertions(+), 64 deletions(-) delete mode 100644 Microsoft.Toolkit/Scalar.cs diff --git a/Microsoft.Toolkit/Diagnostics/ThrowHelper.cs b/Microsoft.Toolkit/Diagnostics/ThrowHelper.cs index 12afe968..239ed10a 100644 --- a/Microsoft.Toolkit/Diagnostics/ThrowHelper.cs +++ b/Microsoft.Toolkit/Diagnostics/ThrowHelper.cs @@ -645,6 +645,39 @@ namespace Microsoft.Toolkit.Diagnostics throw new NotSupportedException(message, innerException); } + /// + /// Throws a new . + /// + /// Thrown with no parameters. + [DoesNotReturn] + public static void ThrowNullReferenceException() + { + throw new NullReferenceException(); + } + + /// + /// Throws a new . + /// + /// The message to include in the exception. + /// Thrown with the specified parameter. + [DoesNotReturn] + public static void ThrowNullReferenceException(string? message) + { + throw new NullReferenceException(message); + } + + /// + /// Throws a new . + /// + /// The message to include in the exception. + /// The inner to include. + /// Thrown with the specified parameter. + [DoesNotReturn] + public static void ThrowNullReferenceException(string? message, Exception? innerException) + { + throw new NullReferenceException(message, innerException); + } + /// /// Throws a new . /// diff --git a/Microsoft.Toolkit/Scalar.cs b/Microsoft.Toolkit/Scalar.cs deleted file mode 100644 index ba92ee03..00000000 --- a/Microsoft.Toolkit/Scalar.cs +++ /dev/null @@ -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 -{ - /// - /// Class containing some constants - /// represented as Floating point numbers. - /// - public static class Scalar - { - // Pi related floating point constants - - /// - /// (float)Math.PI radians ( or 180 degrees). - /// - public const float Pi = (float)Math.PI; - - /// - /// Two times (float)Math.PI radians ( or 360 degrees). - /// - public const float TwoPi = 2f * Pi; - - /// - /// Half of (float)Math.PI radians ( or 90 degrees). - /// - public const float PiByTwo = Pi / 2f; - - /// - /// One third of (float)Math.PI radians ( or 60 degrees). - /// - public const float PiByThree = Pi / 3f; - - /// - /// One fourth of (float)Math.PI radians ( or 45 degrees). - /// - public const float PiByFour = Pi / 4f; - - /// - /// One sixth of (float)Math.PI radians ( or 30 degrees). - /// - public const float PiBySix = Pi / 6f; - - /// - /// Three times half of (float)Math.PI radians ( or 270 degrees). - /// - public const float ThreePiByTwo = 3f * Pi / 2f; - - // Conversion constants - - /// - /// 1 degree in radians. - /// - public const float DegreesToRadians = Pi / 180f; - - /// - /// 1 radian in degrees. - /// - public const float RadiansToDegrees = 180f / Pi; - } -}