EnumExtensions
using System.Runtime.CompilerServices;
namespace NJsonSchema
{
internal static class EnumExtensions
{
private const MethodImplOptions OptionAggressiveInlining = MethodImplOptions.AggressiveInlining;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsNull(this JsonObjectType type)
{
return (type & 8) > 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsNumber(this JsonObjectType type)
{
return (type & 16) > 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsObject(this JsonObjectType type)
{
return (type & 32) > 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsArray(this JsonObjectType type)
{
return (type & 1) > 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsInteger(this JsonObjectType type)
{
return (type & 4) > 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsString(this JsonObjectType type)
{
return (type & 64) > 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsBoolean(this JsonObjectType type)
{
return (type & 2) > 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsFile(this JsonObjectType type)
{
return (type & 128) > 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsNone(this JsonObjectType type)
{
return (int)type == 0;
}
}
}