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

Operators, types, and variables in C#

WBOY
Release: 2023-08-31 18:45:06
forward
1049 people have browsed it

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template