// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) VRMADA, All rights reserved.
//
// --------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
namespace UltimateXR.Extensions.System
{
///
/// Enum extensions.
///
public static class EnumExt
{
#region Public Methods
///
/// Enumerates all flags that are set in the enum value.
///
///
/// Whether to include the 0 in the list
/// List of flags set in the enum value
public static IEnumerable GetFlags(this T self, bool includeZero = false) where T : Enum
{
foreach (T value in Enum.GetValues(self.GetType()))
{
if (self.HasFlag(value) && !(!includeZero && Convert.ToInt32(value) == 0))
{
yield return value;
}
}
}
#endregion
}
}