From c7174255498e28272fbe6d4d6867a774a3327eff Mon Sep 17 00:00:00 2001
From: AmbulantRex <21176662+AmbulantRex@users.noreply.github.com>
Date: Sun, 16 Apr 2023 18:47:57 -0600
Subject: Remove unnecessary type extension and handle feedback.
---
src/Jellyfin.Extensions/TypeExtensions.cs | 45 -------------------------------
1 file changed, 45 deletions(-)
delete mode 100644 src/Jellyfin.Extensions/TypeExtensions.cs
(limited to 'src')
diff --git a/src/Jellyfin.Extensions/TypeExtensions.cs b/src/Jellyfin.Extensions/TypeExtensions.cs
deleted file mode 100644
index 5b1111d59..000000000
--- a/src/Jellyfin.Extensions/TypeExtensions.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Globalization;
-
-namespace Jellyfin.Extensions;
-
-///
-/// Provides extensions methods for .
-///
-public static class TypeExtensions
-{
- ///
- /// Checks if the supplied value is the default or null value for that type.
- ///
- /// The type of the value to compare.
- /// The type.
- /// The value to check.
- /// if the value is the default for the type. Otherwise, .
- public static bool IsNullOrDefault(this Type type, T value)
- {
- if (value is null)
- {
- return true;
- }
-
- object? tmp = value;
- object? defaultValue = type.IsValueType ? Activator.CreateInstance(type) : null;
- if (type.IsAssignableTo(typeof(IConvertible)))
- {
- tmp = Convert.ChangeType(value, type, CultureInfo.InvariantCulture);
- }
-
- return Equals(tmp, defaultValue);
- }
-
- ///
- /// Checks if the object is currently a default or null value. Boxed types will be unboxed prior to comparison.
- ///
- /// The object to check.
- /// if the value is the default for the type. Otherwise, .
- public static bool IsNullOrDefault(this object? obj)
- {
- // Unbox the type and check.
- return obj?.GetType().IsNullOrDefault(obj) ?? true;
- }
-}
--
cgit v1.2.3