Home >Backend Development >C#.Net Tutorial >Operators, types, and variables in C#

Operators, types, and variables in C#

WBOY
WBOYforward
2023-08-31 18:45:061022browse

C# 中的运算符、类型和变量

Variables in C

#Variables are the names of storage areas that our program can operate on. Every variable in C# has a specific type, which determines the size and layout of the variable's memory, the range of values ​​that can be stored in that memory, and the set of operations that can be applied to the variable.

Types in C

#Variables in C# are divided into the following types: value types, reference types and pointer types.

Value type

Value type variables can be directly assigned. They are derived from class system.ValueType.

Reference types

Reference types do not contain the actual data stored in the variable, but contain a reference to the variable.

Using multiple variables, reference types can refer to memory locations. If the data in the memory location is changed by one of the variables, the other variable automatically reflects the change in value. Examples of built-in reference types are: object, dynamic, and string.

Pointer type

Pointer type variable stores another type of memory address.

Operators in C

#Operators are symbols that tell the compiler to perform specific mathematical or logical operations.

Following are the operators -

  • Arithmetic operators
  • Relational operators
  • Logical operators
  • Bit operators
  • Assignment operator

The above is the detailed content of Operators, types, and variables in C#. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete