NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Enum.Format (Type, Object, String)

Converts an enumeration value to human readable format.

[Visual Basic]
Overloads Public Shared Function Format( _
   ByVal enumType As Type, _
   ByVal value As Object, _
   ByVal format As String _
) As String
[C#]
public static string Format(
   Type enumType,
   object value,
   string format
);
[C++]
public: static String* Format(
   Type* enumType,
   Object* value,
   String* format
);
[JScript]
public static function Format(
   enumType : Type,
   value : Object,
   format : String
) : String;

Parameters

enumType
The enumeration type containing the value to be converted.
value
[To be supplied.]
format
[To be supplied.]

Return Value

The value in human readable format.

Exceptions

Exception Type Condition
ArgumentNullException The enumType, value or format parameter is a null reference (in Visual Basic Nothing).
ArgumentException The enumType parameter is not an Enum type.

The value is from an enumeration that differs in type from enumType.

The type of value is not an underlying type of, enumType.

FormatException The format parameter contains an invalid value.

Remarks

The valid format values are:

Item Description
"G" or "g" For PASCAL style enums who's value maps directly the name of the field is returned. For PASCAL style enums who's values do not map directly the decimal value of the field is returned. For BitFlags (indicated by the Flags custom attribute): If for each bit that is set in the value there is a corresponding constant (a pure power of 2), then the OR string (ie "Red | Yellow") is returned. Otherwise, if the value is zero or if you can't create a string that consists of pure powers of 2 OR-ed together, you return a hex value (without the leading "Ox"). That is for example: "000000003".
"X" or "x" Represents the value in hex without the leading 0x.
"D" or "d" Represents the value in decimal.

See Also

Enum Class | Enum Members | System Namespace | Enum.Format Overload List