16 lines
612 B
C#
16 lines
612 B
C#
using JetBrains.Annotations;
|
|
|
|
namespace AyCode.Utils.Extensions
|
|
{
|
|
public static class GuidExtensions
|
|
{
|
|
//[ContractAnnotation("=> true, result: notnull; => false, result: null")]
|
|
//[ContractAnnotation("true => null; false => notnull")]
|
|
public static bool IsNullOrEmpty(this Guid guid) => guid == Guid.Empty;
|
|
|
|
//[ContractAnnotation("=> true, result: notnull; => false, result: null")]
|
|
[ContractAnnotation("guid:null => true; guid:notnull <= false")]
|
|
public static bool IsNullOrEmpty(this Guid? guid) => guid == null || guid == Guid.Empty;
|
|
}
|
|
}
|