Home > Backend Development > C#.Net Tutorial > What data types are provided in c#

What data types are provided in c#

下次还敢
Release: 2024-04-04 17:06:19
Original
1012 people have browsed it

Data types in

C

# Various data types are provided in C# to represent different data values. These types are divided into the following main categories:

Value types

  • Integer types: byte, sbyte, short, ushort, int, uint, long, ulong
  • Floating point type: float, double
  • Character type: char
  • Boolean type: bool
  • Enumeration type: enum

Reference type

  • Class: Self declared as class Defined type
  • Structure: Custom type declared as struct
  • Array: Declared as T[]
  • String: string (actually an alias for the char[] array)
  • Delegate: Type declared as delegate X Y

Other types

  • null: A special value representing no value
  • dynamic: A type that allows the type to be determined at runtime
  • Void: Represents a type that does not return a value

Detailed description

Value type

  • Stored on the stack.
  • Contains values ​​directly, rather than references to other values ​​or objects.
  • When copying, create a copy of the value.

Reference type :

  • is stored in the heap.
  • Contains a reference to another object or value.
  • When copying, create a reference to the original object.

Other types:

  • Null: Represents a missing or uninitialized value.
  • Dynamic: Does not check types at compile time, allowing types to be determined dynamically at runtime.
  • Void: Usually used for the return type of a method or function, indicating that the method or function does not return any value.

The above is the detailed content of What data types are provided in c#. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
c#
source:php.cn
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template