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.
Afficher le fichier Open project: TylerBrinkley/Enums.NET

Méthodes publiques

Méthode 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 méthode

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.
Résultat object

CombineFlags() public static méthode

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.
Résultat object

CommonFlags() public static méthode

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.
Résultat object

FormatFlags() public static méthode

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.
Résultat string

FormatFlags() public static méthode

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.
Résultat string

GetAllFlags() public static méthode

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.
Résultat object

GetFlagMembers() public static méthode

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.
Résultat IEnumerable

GetFlagMembers() public static méthode

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

GetFlags() public static méthode

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.
Résultat IEnumerable

GetFlags() public static méthode

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

HasAllFlags() public static méthode

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.
Résultat bool

HasAllFlags() public static méthode

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.
Résultat bool

HasAnyFlags() public static méthode

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.
Résultat bool

HasAnyFlags() public static méthode

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.
Résultat bool

IsFlagEnum() public static méthode

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.
Résultat bool

IsValidFlagCombination() public static méthode

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.
Résultat bool

ParseFlags() public static méthode

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.
Résultat object

ParseFlags() public static méthode

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.
Résultat object

ParseFlags() public static méthode

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.
Résultat object

ParseFlags() public static méthode

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.
Résultat object

RemoveFlags() public static méthode

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.
Résultat object

ToggleFlags() public static méthode

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.
Résultat object

ToggleFlags() public static méthode

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.
Résultat object

TryParseFlags() public static méthode

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 .
Résultat bool

TryParseFlags() public static méthode

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 .
Résultat bool

TryParseFlags() public static méthode

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 .
Résultat bool

TryParseFlags() public static méthode

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 .
Résultat bool