Show / Hide Table of Contents

Class EnumUtility

Enum Utility Methods.

Inheritance
System.Object
EnumUtility
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: StansAssets.Foundation
Assembly: cs.temp.dll.dll
Syntax
public static class EnumUtility

Methods

CanBeParsed<T>(String, Boolean)

Checks if the string representation of the name or numeric value of one or more enumerated constants can be converted to an equivalent enumerated object.

Declaration
public static bool CanBeParsed<T>(string value, bool ignoreCase = true)
    where T : struct, Enum
Parameters
Type Name Description
System.String value

The string representation of the name or numeric value of one or more enumerated constants.

System.Boolean ignoreCase

true to read value in case insensitive mode; false to read value in case sensitive mode.

Returns
Type Description
System.Boolean

Returns true if the parsed value can be converted to an equivalent enumerated object.

Type Parameters
Name Description
T

The enum type to use for parsing.

ParseOrDefault<T>(String, Boolean)

Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object.

Declaration
public static T ParseOrDefault<T>(string value, bool ignoreCase = true)
    where T : struct, Enum
Parameters
Type Name Description
System.String value

The string representation of the name or numeric value of one or more enumerated constants.

System.Boolean ignoreCase

true to read value in case insensitive mode; false to read value in case sensitive mode.

Returns
Type Description
T

Enumeration constant that represents the parsed value if it can be converted to an equivalent enumerated object. If not, returns default value of type T

Type Parameters
Name Description
T

The enum type to use for parsing.

TryParse<T>(String, out T, Boolean)

Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object.

Declaration
public static bool TryParse<T>(string value, out T result, bool ignoreCase = true)
    where T : struct, Enum
Parameters
Type Name Description
System.String value

The string representation of the name or numeric value of one or more enumerated constants.

T result

When this method returns true, contains an enumeration constant that represents the parsed value.

System.Boolean ignoreCase

true to read value in case insensitive mode; false to read value in case sensitive mode.

Returns
Type Description
System.Boolean

true if the conversion succeeded; false otherwise.

Type Parameters
Name Description
T

The enum type to use for parsing.

In This Article
Back to top Generated by DocFX