EnumExtensionsGetFlagsTEnum Method
Gets an
IEnumerableT enumeration of
flags,
where each flags are returned as distinct values.
Namespace: KGySoft.CoreLibrariesAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
public static IEnumerable<TEnum> GetFlags<TEnum>(
this TEnum flags,
bool onlyDefinedValues = false
)
where TEnum : struct, new()
<ExtensionAttribute>
Public Shared Function GetFlags(Of TEnum As {Structure, New}) (
flags As TEnum,
Optional onlyDefinedValues As Boolean = false
) As IEnumerable(Of TEnum)
public:
[ExtensionAttribute]
generic<typename TEnum>
where TEnum : value class, gcnew()
static IEnumerable<TEnum>^ GetFlags(
TEnum flags,
bool onlyDefinedValues = false
)
[<ExtensionAttribute>]
static member GetFlags :
flags : 'TEnum *
?onlyDefinedValues : bool
(* Defaults:
let _onlyDefinedValues = defaultArg onlyDefinedValues false
*)
-> IEnumerable<'TEnum> when 'TEnum : struct, new()
- flags TEnum
- A flags enum value, whose flags should be returned. It is not checked whether TEnum
is really marked by FlagsAttribute.
- onlyDefinedValues Boolean (Optional)
- to return only flags that are defined in TEnum;
to return also undefined flags. This parameter is optional.
Default value: .
- TEnum
- The type of the enum flags.
IEnumerableTEnumA lazy-enumerated
IEnumerableT instance containing each flags of
flags as distinct values.In Visual Basic and C#, you can call this method as an instance method on any object of type
TEnum. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
The enumerator of the returned collection does not support the
IEnumerator.Reset method.