In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "what are the basics of C#". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn the article "what are the basics of C#".
C # fundamentals-data types
Float (single precision is 7 digits)
Double (double precision is 15 to 16 digits)
Decimal (decimal type has a smaller value than double but it is more accurate)
Decimal d_value = 1.0m / / subscript m is represented as a decimal type. If m is omitted, it is treated as double. Char c_value ='\ X0032' / / hexadecimal escape character char c_value ='\ u0032' / / Unicode representation char c_value ='A'; / / single quotation mark string s_value = "long" / / A double quotation mark string [] s = new string [6] / / character array {..} Click Show CodeShow Code [+] class Test {static void Main () {int [] A1 = new int [] {1,2,3}; / / one-dimensional int [,] a2 = new int [,] {{1,2,3}, {4,5,6}; / / two-dimensional int [,] a3 = new int [10,20,30] / / 3D int [] [] j2 = new int [3] []; / variable length j2 [0] = new int [] {1,2,3}; j2 [1] = new int [] {1,2,3,4,5,6}; j2 [2] = new int [] {1,2,3,4,5,6,7,8,9};}
Structure is a value type, not a reference type, so inheritance is not supported! The structure is stored in the stack or inline. The meticulous structure can improve the storage performance. For example, defining a structure that has the same information as a class can greatly reduce storage space
Struct Point {public int x, y; public Point (int x, int y) {this.x = x; this.y = y;}}
Enumerate
1. You can only take the value of one element in the enumeration at a certain time
two。 Each element type is int and the value of * elements is 0 and the elements that follow it are incremented by 1.
Enum WeekDay {Sunday,Monday,Tuesday} WeekDay day; day = Tuseday
Representative
1. The difference between the function pointer prototype and the pointer in C # means that it is type safe in C #.
two。 Declaration cannot have a return value or a parameter with an output type
Delegate int MyDelegate (); / / declares a representative that points to the prototype of a function of type int
Packing and unpacking
1. You can treat a value type as a reference type
two。 Boxing refers to the implicit or explicit conversion of a value type to an object type
3. Unboxing is an explicit conversion of object types to value types
Basic knowledge of C #-constants and static variables
The constant itself is in the form of a value and no space is allocated in memory; static variables are variables that need to be allocated in the form of memory.
Public static string s_value = "this is a" + s_dog; / / assume that s_dog is another variable initialization value can be changed according to different s_dog public const double X = 1.0, Y = 2.0 / value can not be changed
Basic knowledge of C #-Type conversion
(type) variable
Convert.toXXX (variable)
These are all the contents of the article "what are the basics of C#". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.