// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; #nullable enable namespace osu.Framework.Extensions.ObjectExtensions { /// /// Extensions that apply to all objects. /// public static class ObjectExtensions { /// /// Coerces a nullable object as non-nullable. This is an alternative to the C# 8 null-forgiving operator "!". /// /// /// This should only be used when an assertion or other handling is not a reasonable alternative. /// /// The nullable object. /// The type of the object. /// The non-nullable object corresponding to . public static T AsNonNull(this T? obj) where T : class { Debug.Assert(obj != null); return obj; } } }