Skip to main content
.NET 8.0+

EnumDescriptor.GetCaption(Object) Method

Returns the display caption associated with a specified value of the enumeration represented by the EnumDescriptor.

Namespace: DevExpress.ExpressApp.Utils

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public string GetCaption(
    object value
)

Parameters

Name Type Description
value Object

An object representing the enumeration value whose corresponding display caption will be retrieved.

Returns

Type Description
String

A string representing the display caption associated with the specified value of the enumeration represented by the EnumDescriptor.

Remarks

The following code snippet illustrates use of the GetCaption method. The code retrieves images and display captions associated with MyEnum enumeration values.

//...
EnumDescriptor myDescriptor = new EnumDescriptor(typeof(MyEnum));
foreach(object enumValue in myDescriptor.Values) {
    string caption = myDescriptor.GetCaption(enumValue);
    var image = myDescriptor.GetImageInfo(enumValue).Image;
    //process caption and image
}
See Also