In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "the classification and usage of C # operator". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Arithmetic: +-* /%
Logic: & | ^ ~ & & | |!
String concatenation: +
Self-addition, self-subtraction: +-
Shift: >
Compare: =
< >=
Assignment: = + =-= * / =% = & = | = ^ = =
Fetch reference: []
Type: sizeof is typeof as
Overflow exception: checked unchecked
Null coalescing operator:??
Is of the ◆ C # operator
Check whether the current object is compatible with the type to be checked, that is, whether it is or inherits from this type
Int I = 10; if (i is object) {Console.WriteLine ("i is an object");}
As of the ◆ C # operator
Explicit type conversion, which returns null if the type is not compatible
Object o1 = "Some String"; object O2 = 5; string S1 = o1 as string; / / S1 = "Some String" string S2 = O2 as string; / / S2 = null
Typeof
Returns the System.Type type
Nullable Types and Operators:? of the ◆ C # operator
In C #, a variable of a value type cannot be Null, it contains the type of a value type itself. This is why we call value types value types.
But in many cases there will be problems. You can define that the data type of a column is the integer of 32bit and corresponds to the Int32 type in FCL. However, this column is in the number
According to the hint that it may be empty in the library, it is acceptable that the data in this column is empty. But use the .NET Framework to manipulate the data in the database
Is difficult because CLR does not allow the representation that the value of int32 is empty.
To improve this form, Microsoft added a variable of type Nullable to CLR.
Int32? A = 5; Int32? B = null; Int32? C = (Int32) a; Double? D = 5; Double? E = b; a match / null a = 6b =-b = null a = a + 3; / a = 9 b = b * 3; / b =
For (+ + = =! ~) unary, if you start null, the result is still null.
(+ + = =! ~) if you start null, the result is still null.
(+-* /% & | ^ >) binary, one is null, the other is also null
(=). The = operator, if all operands are null, then they are equal. If one is null, then you don't want to wait. If none of them are null, compare the values and return whether they are equal.
(
< >=) the comparison operator, if one is null, returns false. If none of them are null, compare the size of the value. And then go back.
◆ C # operator?
Two operands are required. If the Operand on the left is not null, the Operand on the left is returned. If the operator on the left is empty, return to the operator on the right.
?? It is convenient to operate and can be used to set the initial value of a variable.
Int32? B = null; Int32? X = b? 123; this is the end of the introduction to the classification and usage of C # operators. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.