The condition operator is associated to the right and is calculated from left to right, so? B: C? D: E should be understood as? B :( C? D: E ).The nullable data type is implemented in C #2.0,Abandon pairobjectDataif(object==null. At the same time, you will find that,In database applications, some fields in the Database allow null values, and the introduction of the nullable type in the C # world exactly corresponds, Ing from (C #) objects to relational database objects, or vice versa, the conversion is relatively smooth.In order to convert the nullable data type into non-nullable data, there is such an operator "?? (Two question marks) ", the double question mark Operator means to take the assigned value ?? Left, if the left isnull, Take the assigned value ?? On the right,For exampleintY = x ?? -1 if X is null, the value of Y is-1.At this time, you can change the second code at the top:stringstrParam= Request.Params["param"]?? "";Hey, is it more concise.There are also "? (Single question mark) "modifier, abbreviated form of system. nullable, suchint? Represents an empty integer,For example:int? A = 1 orint? b=null. The nullable type has a hasvalueboolType Read-only property,This attribute istrueIt indicates that the instance is a non-empty instance and contains a known value,Hasvalue isfalseWhen the value attribute is accessed, system. invalidoperationexception occurs.Reprinted: http://www.cnblogs.com/refactor/archive/2012/05/30/2526147.html
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