The note of learning ASP. NET [13] About constants, enumerations, structs in. net

Source: Internet
Author: User
Constants is a constant, which can be defined using const like a normal variable, but its value cannot be changed during the application program running, for example, our common circumference rate. Enumerations is an enumeration type. It is a collection of related constants and is defined using the enum identifier. It has two fields: name and number. You can call this operation by enumerative name. Name field. Example: Enum weekday {Sunday = 1, Monday = 2, Tuesday = 3, Wednesday = 4, Thursday = 5, Friday = 6, Saturday = 7 ,} we can use weekday when calling. sunday is called in this way. The returned value is 1 structs and the structure type. It is similar to the enumeration type, but the numeric fields equivalent to Enumeration type can store any type of data. Use struct to define an example: struct person {Public String firstname; Public String lastname; Public int age;} person; person. firstname = "lei"; person. lastname = "rong" person. age = 25; system. console. write ("{0} {1} is a {2} years old boy. ", person. firstname, person. lastname, person. age );

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.