EnumExtensionsGetDisplayName 方法
Gets the display name for an enum value as specified by DisplayNameAttribute
获取枚举值的显示名称(通过DisplayNameAttribute指定)
命名空间: DeploySharp.Engine程序集: DeploySharp (在 DeploySharp.dll 中) 版本:0.0.4+6e8a2e904469617cd59619d666c0e272985c0e33
public static string GetDisplayName(
this Enum value
)
- value Enum
- The enum value to get the display name for 要获取显示名称的枚举值
String
The display name if specified by DisplayNameAttribute, otherwise the enum value's string representation
如果通过DisplayNameAttribute指定了显示名称则返回该名称,否则返回枚举值的字符串表示
在 Visual Basic 和 C# 中,这个方法可以当成为类型
Enum 的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考
扩展方法 (Visual Basic) 或
扩展方法 (C# 编程指南) 获取更多信息。
var name = DeviceType.CPU.GetDisplayName(); // Returns "CPU"
var name = InferenceBackend.OpenVINO.GetDisplayName(); // Returns "OpenVINO"