This article mainly introduces the relevant information about C# getting the corresponding text description from the enumeration value. Friends who need it can refer to the C# getting the corresponding text description from the enumeration value. Sometimes when the enumeration value is displayed, it needs to Displays the text string corresponding to the enumeration value. One solution is to use switch or if to judge the enumeration value at the place of call, and then assign it to different text strings, but this will be more troublesome if it is used in many places. Of course, some people say that in this case, you can encapsulate a method for this enumeration value and then call it. What if there are multiple enumeration types that have such a requirement? Is there any more general solution? some. You need to use the Description attribute here, assign this attribute to each enumeration value, and then assign the text string to be described in this attribute. For example #region YesNoEnum public enum YesNoEnum { [Description(&
##Introduction: This article mainly introduces the relevant information on how C# obtains the corresponding text description from the enumeration value. Friends in need can refer to the following
2. Detailed explanation of sample code for extending enumeration list in XML schema
Introduction : Adding a new value to a list is a common and necessary requirement. Schema designers often want to build a way to add additional value to the system architecture, and how this additional value is created is unknown to the schema designer during the design phase. An extensible, easy-to-implement enumeration value list? This article will introduce several methods to achieve this goal. Pattern designers and implementers need an extension
##3.HTML5 study notes concise version (5): input type super type
Introduction: HTML5 is input The type type adds a variety of enumeration values to express different meanings. It also has a verification function. If the format is incorrect, the browser will initially provide an error prompt, which is super awesome. The details are as follows:
4.
##Introduction: LIST partition and RANGE partitioning is very similar. The main difference is that LIST is a collection of enumerated value lists, and RANGE is a collection of continuous interval values. The syntax of the two is very similar. It is also recommended that the LIST partitioning column be a non-null column, otherwise a null value will be inserted. If there is no null value in the enumeration list, the insertion will fail. This is different from other partitions. The RANGE partition will store it as the minimum partition value. HASH\KEY will convert it into 0 for storage. The main LIST partition only supports it. Integer and non-integer fields need to be converted into integer through functions; after version 5.5, function conversion is not required and the LIST COLUMN partition is used to support non-integer fields. In the COLUMN partition
##5. PropertyGrid The enumeration in is displayed in Chinese
Introduction: The enumeration in PropertyGrid is displayed in Chinese. In system development, PropertyGrid is often used to modify or display the properties of an object. , if an enumeration is defined in the class, the enumeration items or enumeration values will be displayed by default, but this is not what we want. The user does not know what the item represents when using it. The enumeration shows
[Related Q&A recommendations]:
Architecture design - JAVA side error codes and error messages, should they be designed as global constants or Enumeration value?
java - copy(InputStream in, Path target, CopyOption... options) using
Access method of enumeration value in C/C++
The above is the detailed content of How to use enumeration values? Summary of enumeration value instance usage. For more information, please follow other related articles on the PHP Chinese website!