This is the 14th day of my participation in the August Text Challenge.More challenges in August

C # 🔥

Introduction to the

C# is Microsoft released in June 2000 released an object-oriented, secure, stable, simple, elegant C and C++ derived from the object-oriented programming language, it inherits C and C++ powerful functions while removing some of their complex features, run in. The.net Framework and. A high-level programming language on top of NET Core (fully open source, cross-platform). C# is pronounced C Sharp. Originally it had a cooler name, called COOL. Microsoft started the COOL project in December 1998, until February 2000, when COOL was officially renamed C#.

A brief introduction, the last article has a special introduction oh ~~

This article introduces some of the basics of C#. It follows on from a previous blog post about base, source inverse, and basic syntax in C#

Portal C# basic knowledge introduction (1)


Basic knowledge 🎓

Hexadecimal 🙉

Base system is a computer necessary knowledge, here is a simple introduction to conversion usage, not to do more

Binary ———— binary octal ———— decimal decimal ———— hexadecimal ———— hexadecimal


One into two: 0, 1, 101, 1100 One into eight: 17, 21, 33, 41 One into ten: 1, 12, 33, 4, 5, 6, 99 One into sixteen: 9, A, B, C, D, E, F, 3F, 10


Method 1:666 = 512 + 128 + 16 + 1 = 10 1001 0001


Octal to binary formula: remember 1, 2, 4, 1, 6, 001, 010, 110


Binary to octal formula: remember one, two, four, three digits in one: 110, 111, 001, 6, 7, 1


1 A 2 F 0001 1010 0010 1111 1 A 2 F 0001 1010 0010 1111


Binary to hexadecimal formula: remember one, two, four and eight, four digits merged into one digit 0001 1011 1001 1 B 9


Source code inverse code complement 🙈

The source code, inverse code, and complement of positive numbers are the same. The source code is 0 1111111. The inverse code is 0 1111111

The original code 1, 1111111
Inverse of a negative number 1, 0000000 Symbol bit unchanged, the other bits of the original code
The complement of a negative number 1, 0000001 Sign bit unchanged, inverse +1

Basic syntax 🙊

Using keyword 👂

The first statement in any C# program is:

using System; The using keyword is used to include namespaces in programs. A program can contain multiple using statements.


The class keyword 👀

The class keyword is used to declare a class.


Comments in C# ❄️

Comments are used to explain code. The compiler ignores annotated entries. In C# programs, multi-line comments start with /* and end with the character */, as follows:

/*This program demonstrates The basic syntax of C# programming Language */
Copy the code

Single-line comments are indicated by the ‘//’ symbol. Such as:

}//end class Rectangle  
Copy the code

Member variable 👥

Variables are attributes or data members of a class that are used to store data. In the above program, the Rectangle class has two member variables named Length and Width.


Member function 👤

A function is a series of statements that perform a specified task. Member functions of a class are declared within the class. Our example Rectangle class contains three member functions: AcceptDetails, GetArea, and Display.


Instantiate a class 💬

In the above program, the ExecuteRectangle class is a class that contains the Main() method and instantiates the Rectangle class.


Identifier ⚡ ️

An identifier is used to identify a class, variable, function, or any other user-defined item. In C#, class naming must follow the following basic rules:

  • The identifier must start with a letter, underscore (_), or @, and can be followed by a series of letters, digits (0-9), underscores (_), and @.
  • The first character in an identifier cannot be a number.
  • Identifiers must not contain any embedded Spaces or symbols, such as? – +! # % ^ & * () [] {}. : “‘ / \
  • Identifiers cannot be C# keywords. Unless they have an @ prefix. For example, @if is a valid identifier, but if is not, because if is a keyword.
  • Identifiers must be case sensitive. Upper and lower case letters are considered different letters.
  • Cannot be the same as the C# library name.

C# keyword ☀️

Keywords are predefined reserved words by the C# compiler. These keywords cannot be used as identifiers, but if you want to use them as identifiers, you can prefix them with the @ character. In C#, there are keywords that have special meaning within the context of your code, such as get and set. These are called contextual keywords. The following chart lists Reserved Keywords and Contextual Keywords in C# :