What does it mean to add a question mark after the data type ?, Data Type question mark

Source: Internet
Author: User

What does it mean to add a question mark after the data type ?, Data Type question mark

During. net development, I saw a piece of code of this type:

Public double? AskLeave {get; set ;}

I can't figure it out. Why do I need to add a question mark? Now I know why:

By default, attribute values of the double type cannot be null. If a question mark is added, the value can be null. In fact, the nullabl interface is implemented, and so on, if this question mark is added to other data types, this is also the reason.

 

When I saw the comments, I checked the materials on the Internet. If you are interested, you can check these three URLs to help you understand them.

Http://tieba.baidu.com/p/1343474351

Http://www.cnblogs.com/Holmes-Jin/archive/2012/01/13/2321841.html

Http://www.cnblogs.com/holly/archive/2010/02/02/1662256.html

 

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.