Files
pgsql-jellyfin/src/Jellyfin.Extensions/GuidExtensions.cs
T

34 lines
1.1 KiB
C#

// <copyright file="GuidExtensions.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
#pragma warning disable CA1720 // Variable contains type name
namespace Jellyfin.Extensions
{
using System;
using System.Diagnostics.CodeAnalysis;
/// <summary>
/// Guid specific extensions.
/// </summary>
public static class GuidExtensions
{
/// <summary>
/// Determine whether the guid is default.
/// </summary>
/// <param name="guid">The guid.</param>
/// <returns>Whether the guid is the default value.</returns>
public static bool IsEmpty(this Guid guid)
=> guid.Equals(default);
/// <summary>
/// Determine whether the guid is null or default.
/// </summary>
/// <param name="guid">The guid.</param>
/// <returns>Whether the guid is null or the default valueF.</returns>
public static bool IsNullOrEmpty([NotNullWhen(false)] this Guid? guid)
=> guid is null || guid.Value.IsEmpty();
}
}