How are enumeration values used? Summarize enumeration value Instance usage

Source: Internet
Author: User
This article mainly introduces C # from the enumeration value to get the corresponding text description of the relevant information, the need for friends can refer to C # from the enumeration value to get the corresponding text description of the enumeration value in the display, you need to display the enumeration value corresponding to the text string. One option is to use switch or if at the call to determine the enumeration value and then assign it to a different text string, but this can be cumbersome if more places are used. 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 require this? Is there a more general solution? Some. You need to use the Description property, assign the attribute to each enumeration value, and then assign the text string that you want to describe in the property. For example #region Yesnoenum public enum Yesnoenum {[Description (&

1. C # to get the text from the enumeration values

Introduction: This article mainly introduces C # from the enumeration value to obtain the corresponding text description of the relevant information, the need for friends can refer to the following

2. Example code for extending an enumeration list in XML Schema

Summary: Adding new values to a list is a common and necessary requirement. Pattern designers often want to build a method of adding added value in the system architecture, and that added value is unknown at design time. How does the pattern designer create a list of extensible, easy-to-implement enumeration values? This article describes several ways to achieve this goal. Pattern designers and implementation personnel need an extended

3. HTML5 Study Notes Concise version (5): Type Super type of input

Introduction: HTML5 added a variety of enumeration values to the type of input, to express different meanings, colleagues have the authentication function, if the format is not correct, the browser will provide the original error message, called Super Bull X, as follows:

4. MySQL list partition

Summary: The list partition and range partition are very similar, the main difference is that the list is a collection of enumeration value lists, and range is a continuous set of interval values. The two are very similar in terms of syntax. It is also recommended that the list partition column is a non-null column, otherwise inserting a null value if there is no null value in the enumeration list fails to insert, which is not the same as other partitions, and the range partition stores it as a minimum partition value, which is hash\key into 0 storage. The primary list partition only supports shaping, and non-shaping fields need to be converted to shaping by functions; After version 5.5, you can use the list column partition to support non-shaping fields, and the column partition

5. The enumeration in PropertyGrid is displayed in Chinese

Summary: The enumeration in PropertyGrid is displayed as Chinese in system development, PropertyGrid is often used to modify or display the properties of an object, and if an enumeration is defined in a class, the enumeration's items or enumeration values are displayed by default at the time of presentation, but this is not what we want. The user is not aware of the meaning of the item when it is used. The enumeration display has been described before

"Related question and answer recommendation":

Schema design-Java side error code and error message, is the design a global constant or an enumeration value?

Java-How to handle the foreground to show, but the database table does not have the entity class redundancy attribute of the field?

Java-copy (InputStream in, Path target, copyoption ... options) use

Javascript-typescript assigning values to variables namespace the enumeration values inside the error

Access methods for enumeration values in C + +

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.