C# Class EnumsNET.NonGeneric.NonGenericFlagEnums

A non-generic implementation of the static class FlagEnums. When the type is known at compile-time the FlagEnums class should be used instead, to provide type safety and to avoid boxing.
Mostra file Open project: TylerBrinkley/Enums.NET

Public Methods

Method Description
CombineFlags ( Type enumType ) : object

Combines all of the flags of flags.

CombineFlags ( Type enumType, object value, object otherFlags ) : object

Combines the flags of value and otherFlags. Equivalent to the bitwise "or" operation.

CommonFlags ( Type enumType, object value, object otherFlags ) : object

Returns value with only the flags that are also in otherFlags. Equivalent to the bitwise "and" operation.

FormatFlags ( Type enumType, object value ) : string

Retrieves the names of value's flags delimited with commas or if empty returns the name of the zero flag if defined otherwise "0". If value is not a valid flag combination null is returned.

FormatFlags ( Type enumType, object value, string delimiter ) : string

Retrieves the names of value's flags delimited with delimiter or if empty returns the name of the zero flag if defined otherwise "0". If value is not a valid flag combination null is returned.

GetAllFlags ( Type enumType ) : object

Retrieves all the flags defined by enumType.

GetFlagMembers ( Type enumType, object value ) : IEnumerable

Retrieves the EnumMember{TEnum}s of the flags that compose value.

GetFlagMembers ( this member ) : IEnumerable

Retrieves the EnumMembers of the flags that compose member's value.

GetFlags ( Type enumType, object value ) : IEnumerable

Retrieves the flags that compose value.

GetFlags ( this member ) : IEnumerable

Retrieves the flags that compose member's value.

HasAllFlags ( Type enumType, object value ) : bool

Indicates if value has all of the flags that are defined in enumType.

HasAllFlags ( Type enumType, object value, object otherFlags ) : bool

Indicates if value has all of the flags that are in otherFlags.

HasAnyFlags ( Type enumType, object value ) : bool

Indicates if value has any flags.

HasAnyFlags ( Type enumType, object value, object otherFlags ) : bool

Indicates if value has any flags that are in otherFlags.

IsFlagEnum ( Type enumType ) : bool

Indicates if enumType is marked with the FlagsAttribute.

IsValidFlagCombination ( Type enumType, object value ) : bool

Indicates whether value is a valid flag combination of enumType's defined flags.

ParseFlags ( Type enumType, string value ) : object

Converts the string representation of one or more member names or values of enumType to its respective value of type enumType.

ParseFlags ( Type enumType, string value, bool ignoreCase ) : object

Converts the string representation of one or more member names or values of enumType to its respective value of type enumType. The parameter ignoreCase specifies if the operation is case-insensitive.

ParseFlags ( Type enumType, string value, bool ignoreCase, string delimiter ) : object

Converts the string representation of one or more member names or values of enumType delimited with delimiter to its respective value of type enumType. The parameter ignoreCase specifies if the operation is case-insensitive.

ParseFlags ( Type enumType, string value, string delimiter ) : object

Converts the string representation of one or more member names or values of enumType delimited with delimiter to its respective value of type enumType.

RemoveFlags ( Type enumType, object value, object otherFlags ) : object

Returns value without the flags specified in otherFlags.

ToggleFlags ( Type enumType, object value ) : object

Returns value with all of it's flags toggled. Equivalent to the bitwise "xor" operator with GetAllFlags(Type).

ToggleFlags ( Type enumType, object value, object otherFlags ) : object

Returns value while toggling the flags that are in otherFlags. Equivalent to the bitwise "xor" operator.

TryParseFlags ( Type enumType, string value, bool ignoreCase, object &result ) : bool

Tries to convert the string representation of one or more member names or values of enumType to its respective value of type enumType. The parameter ignoreCase specifies whether the operation is case-insensitive. The return value indicates whether the conversion succeeded.

TryParseFlags ( Type enumType, string value, bool ignoreCase, string delimiter, object &result ) : bool

Tries to convert the string representation of one or more member names or values of enumType delimited with delimiter to its respective value of type enumType. The parameter ignoreCase specifies whether the operation is case-insensitive. The return value indicates whether the conversion succeeded.

TryParseFlags ( Type enumType, string value, object &result ) : bool

Tries to convert the string representation of one or more member names or values of enumType to its respective value of type enumType. The return value indicates whether the conversion succeeded.

TryParseFlags ( Type enumType, string value, string delimiter, object &result ) : bool

Tries to convert the string representation of one or more member names or values of enumType delimited with delimiter to its respective value of type enumType. The return value indicates whether the conversion succeeded.

Method Details

CombineFlags() public static method

Combines all of the flags of flags.
or is null. is not an enum type /// -or- /// contains a value that is of an invalid type.
public static CombineFlags ( Type enumType ) : object
enumType System.Type The enum type.
return object

CombineFlags() public static method

Combines the flags of value and otherFlags. Equivalent to the bitwise "or" operation.
, , or is null. is not an enum type /// -or- /// or is of an invalid type.
public static CombineFlags ( Type enumType, object value, object otherFlags ) : object
enumType System.Type The enum type.
value object The flags enum value.
otherFlags object The other flags enum value.
return object

CommonFlags() public static method

Returns value with only the flags that are also in otherFlags. Equivalent to the bitwise "and" operation.
, , or is null. is not an enum type /// -or- /// or is of an invalid type.
public static CommonFlags ( Type enumType, object value, object otherFlags ) : object
enumType System.Type The enum type.
value object The flags enum value.
otherFlags object The other flags enum value.
return object

FormatFlags() public static method

Retrieves the names of value's flags delimited with commas or if empty returns the name of the zero flag if defined otherwise "0". If value is not a valid flag combination null is returned.
or is null. is not an enum type /// -or- /// is of an invalid type.
public static FormatFlags ( Type enumType, object value ) : string
enumType System.Type The enum type.
value object The flags enum value.
return string

FormatFlags() public static method

Retrieves the names of value's flags delimited with delimiter or if empty returns the name of the zero flag if defined otherwise "0". If value is not a valid flag combination null is returned.
or is null. is not an enum type /// -or- /// is of an invalid type.
public static FormatFlags ( Type enumType, object value, string delimiter ) : string
enumType System.Type The enum type.
value object The flags enum value.
delimiter string The delimiter to use to separate individual flags.
return string

GetAllFlags() public static method

Retrieves all the flags defined by enumType.
is null. is not an enum type.
public static GetAllFlags ( Type enumType ) : object
enumType System.Type The enum type.
return object

GetFlagMembers() public static method

Retrieves the EnumMember{TEnum}s of the flags that compose value.
or is null. is not an enum type /// -or- /// is of an invalid type.
public static GetFlagMembers ( Type enumType, object value ) : IEnumerable
enumType System.Type The enum type.
value object The flags enum value.
return IEnumerable

GetFlagMembers() public static method

Retrieves the EnumMembers of the flags that compose member's value.
is null.
public static GetFlagMembers ( this member ) : IEnumerable
member this The enum member.
return IEnumerable

GetFlags() public static method

Retrieves the flags that compose value.
or is null. is not an enum type /// -or- /// is of an invalid type.
public static GetFlags ( Type enumType, object value ) : IEnumerable
enumType Type The enum type.
value object The flags enum value.
return IEnumerable

GetFlags() public static method

Retrieves the flags that compose member's value.
is null.
public static GetFlags ( this member ) : IEnumerable
member this The enum member.
return IEnumerable

HasAllFlags() public static method

Indicates if value has all of the flags that are defined in enumType.
or is null. is not an enum type /// -or- /// is of an invalid type.
public static HasAllFlags ( Type enumType, object value ) : bool
enumType Type The enum type.
value object The flags enum value.
return bool

HasAllFlags() public static method

Indicates if value has all of the flags that are in otherFlags.
, , or is null. is not an enum type /// -or- /// or is of an invalid type.
public static HasAllFlags ( Type enumType, object value, object otherFlags ) : bool
enumType Type The enum type.
value object The flags enum value.
otherFlags object The other flags enum value.
return bool

HasAnyFlags() public static method

Indicates if value has any flags.
or is null. is not an enum type /// -or- /// is of an invalid type.
public static HasAnyFlags ( Type enumType, object value ) : bool
enumType Type The enum type.
value object The flags enum value.
return bool

HasAnyFlags() public static method

Indicates if value has any flags that are in otherFlags.
, , or is null. is not an enum type /// -or- /// or is of an invalid type.
public static HasAnyFlags ( Type enumType, object value, object otherFlags ) : bool
enumType Type The enum type.
value object The flags enum value.
otherFlags object The other flags enum value.
return bool

IsFlagEnum() public static method

Indicates if enumType is marked with the FlagsAttribute.
is null. is not an enum type.
public static IsFlagEnum ( Type enumType ) : bool
enumType Type The enum type.
return bool

IsValidFlagCombination() public static method

Indicates whether value is a valid flag combination of enumType's defined flags.
or is null. is not an enum type /// -or- /// is of an invalid type.
public static IsValidFlagCombination ( Type enumType, object value ) : bool
enumType Type The enum type.
value object The flags enum value.
return bool

ParseFlags() public static method

Converts the string representation of one or more member names or values of enumType to its respective value of type enumType.
or is null. is not an enum type /// -or- /// doesn't represent a member name or value of . is outside the range of 's underlying type.
public static ParseFlags ( Type enumType, string value ) : object
enumType Type The enum type.
value string The enum member names or values' string representation.
return object

ParseFlags() public static method

Converts the string representation of one or more member names or values of enumType to its respective value of type enumType. The parameter ignoreCase specifies if the operation is case-insensitive.
or is null. is not an enum type /// -or- /// doesn't represent a member name or value of . is outside the range of the underlying type of .
public static ParseFlags ( Type enumType, string value, bool ignoreCase ) : object
enumType Type The enum type.
value string The enum member names or values' string representation.
ignoreCase bool Indicates if the operation is case-insensitive.
return object

ParseFlags() public static method

Converts the string representation of one or more member names or values of enumType delimited with delimiter to its respective value of type enumType. The parameter ignoreCase specifies if the operation is case-insensitive.
or is null. is not an enum type /// -or- /// doesn't represent a member name or value of . is outside the range of the underlying type of .
public static ParseFlags ( Type enumType, string value, bool ignoreCase, string delimiter ) : object
enumType Type The enum type.
value string The enum member names or values' string representation.
ignoreCase bool Indicates if the operation is case-insensitive.
delimiter string The delimiter used to separate individual flags.
return object

ParseFlags() public static method

Converts the string representation of one or more member names or values of enumType delimited with delimiter to its respective value of type enumType.
or is null. is not an enum type /// -or- /// doesn't represent a member name or value of . is outside the range of 's underlying type.
public static ParseFlags ( Type enumType, string value, string delimiter ) : object
enumType Type The enum type.
value string The enum member names or values' string representation.
delimiter string The delimiter used to separate individual flags.
return object

RemoveFlags() public static method

Returns value without the flags specified in otherFlags.
, , or is null. is not an enum type /// -or- /// or is of an invalid type.
public static RemoveFlags ( Type enumType, object value, object otherFlags ) : object
enumType Type The enum type.
value object The flags enum value.
otherFlags object The other flags enum value.
return object

ToggleFlags() public static method

Returns value with all of it's flags toggled. Equivalent to the bitwise "xor" operator with GetAllFlags(Type).
or is null. is not an enum type /// -or- /// is of an invalid type.
public static ToggleFlags ( Type enumType, object value ) : object
enumType Type The enum type.
value object The flags enum value.
return object

ToggleFlags() public static method

Returns value while toggling the flags that are in otherFlags. Equivalent to the bitwise "xor" operator.
, , or is null. is not an enum type /// -or- /// or is of an invalid type.
public static ToggleFlags ( Type enumType, object value, object otherFlags ) : object
enumType Type The enum type.
value object The flags enum value.
otherFlags object The other flags enum value.
return object

TryParseFlags() public static method

Tries to convert the string representation of one or more member names or values of enumType to its respective value of type enumType. The parameter ignoreCase specifies whether the operation is case-insensitive. The return value indicates whether the conversion succeeded.
is null. is not an enum type.
public static TryParseFlags ( Type enumType, string value, bool ignoreCase, object &result ) : bool
enumType Type The enum type.
value string The enum member names or values' string representation.
ignoreCase bool Indicates if the operation is case-insensitive.
result object If the conversion succeeds this contains a value of type that is represented by .
return bool

TryParseFlags() public static method

Tries to convert the string representation of one or more member names or values of enumType delimited with delimiter to its respective value of type enumType. The parameter ignoreCase specifies whether the operation is case-insensitive. The return value indicates whether the conversion succeeded.
is null. is not an enum type.
public static TryParseFlags ( Type enumType, string value, bool ignoreCase, string delimiter, object &result ) : bool
enumType Type The enum type.
value string The enum member names or values' string representation.
ignoreCase bool Indicates if the operation is case-insensitive.
delimiter string The delimiter used to separate individual flags.
result object If the conversion succeeds this contains a value of type that is represented by .
return bool

TryParseFlags() public static method

Tries to convert the string representation of one or more member names or values of enumType to its respective value of type enumType. The return value indicates whether the conversion succeeded.
is null. is not an enum type.
public static TryParseFlags ( Type enumType, string value, object &result ) : bool
enumType Type The enum type.
value string The enum member names or values' string representation.
result object If the conversion succeeds this contains a value of type that is represented by .
return bool

TryParseFlags() public static method

Tries to convert the string representation of one or more member names or values of enumType delimited with delimiter to its respective value of type enumType. The return value indicates whether the conversion succeeded.
is null. is not an enum type.
public static TryParseFlags ( Type enumType, string value, string delimiter, object &result ) : bool
enumType Type The enum type.
value string The enum member names or values' string representation.
delimiter string The delimiter used to separate individual flags.
result object If the conversion succeeds this contains a value of type that is represented by .
return bool