C #: Is the data type the same as the type?

maybe it's stupid, but I'm not sure if there is a difference between data types and data types

int - data type

class A{}

A - data type or type?

+3
source share
6 answers

There is no such thing as a data type in any .NET language. A “data type” is often used to clarify a “type” in order to refer to the actual type of the runtime, rather than a more abstract idea of ​​what kind of value is present.

int - , . (int, double, char ..) , string, (, , ).

, class, . , struct, .

+2

.NET . enum struct, class.

int System.Int32, , A , .

+7

+4

, . , A .

0

A - , /-, (int, string)

, , ( ).

0

# Spec 1.3

1.3

# : . , , . , , , , . , , , ( ref out).

C # value types are further divided into simple types, enumeration types, structure types, and types with a null value , and C # reference types are further divided into types , interface types, array types, and delegate types .

and int is the value type, which is also a simple type, as well as a signed integral

class a {} is a reference type, which is a type of class that is defined by the user.

0
source

Source: https://habr.com/ru/post/1764044/


All Articles