当前位置:网站首页>Type ~ storage ~ variable in C #
Type ~ storage ~ variable in C #
2022-06-30 18:09:00 【Dotnet cross platform】

Welcome to be my reader , I hope this article can give you some help .
Preface
Today, I saw friends in the group talking about calling fans readers , This makes me very excited .
I used to pay more attention to the amount of articles I read , Has anyone forwarded , How many new concerns are added today . And now , My focus has changed , No longer care about these external things , Think about what you can write to your readers , Does what you write help you .
by the way , In the future, I will push two articles about qiafan over the weekend , I hope all readers have the honor to read , You can click it a little , Just exit again , Thank you for your support .
Review with you today C# The most basic knowledge in .
General situation ,C A program is a set of functions and data types ,C++ Is a set of functions and classes , and C# A program is a set of type declarations (JAVA equally ).
So what kind of writing counts as C# The procedure .
C# Procedure or DLL The source code for is a set of type declarations
For executable programs , A type declaration must contain Main Class of method
A namespace is a way to group and name related type declarations .
// Namespace
namespace WindowsApplication2
{
/// <summary>
/// Representative class
/// </summary>
class Test
{
// Declare and define variables or attributes
private int Name { get; set; }
private string Age { get; set; }
}
}type
So what is the type ?
Think of a type as a template for creating data structures . The template itself is not a data structure , But it specifies the characteristics of the objects constructed by the template .
Type by name 、 The data structure used to store data members and some behaviors and constraints constitute .
So how to use types ?
This requires instantiation of the type , That is, to create an actual object from a type template . stay C# In the program , Each data item is an instance of some kind , Some of these types come with the language itself , There are plenty of them BCL Or other libraries , It can also be customized by programmers .
Storage
stay C# The data in is stored with various types of variables .
short、int and long Etc. is a simple type , This type of storage can only store one data item at a time . Array (array) Type can store multiple data items , Reference these elements by index .
However, there are other types that can contain many different types of data items , The data item individuals in these types are called members , It has a unique name . Including data members and function members .
class Test
{
// Data member
private string Name { get; set; }
private int Age { get; set; }
// Members of the function
private string GetName()
{
return this.Name;
}
}stay C# Provided in the 15 There are two predefined types , These include 13 Two simple types and 2 A non simple type .
Simple type
11 Number types , Various integer types , Floating point type float and double, One is called decimal High precision decimal type of . A kind of Unicode Character type char, A boolean type bool.
stay C# The numeric type in does not have a Boolean meaning .
Two non simple types
string, It's a kind of Unicode A character array .object, Is the base class for all other types .


You can also user-defined types , There is a total of 6 The type in can be created by the user .
Class structure (class)
Structure type (struct)
data type (array)
Enumeration type (enum)
Delegate type (delegate)
Interface type (interface)
Once the type is declared , You can create and use this type of object , Just as they are predefined types .
For any object of reference type , All its data members are stored in the heap , Whether they are value types or reference types .
remarks
Life is short , I don't want to pursue what I can't see , I just want to catch what I can see .
Originality is not easy. , Pay attention .
I am a A Hui , Thank you for reading , If it helps you , Please like it 、 forward thank you .
I'm glad to be friends with you .

Previous recommendation
C# Data dictionary in Dictionary

边栏推荐
- 5g business is officially commercial. What are the opportunities for radio and television?
- 构建基本buildroot文件系统
- Mo Tianlun salon | Tsinghua qiaojialin: Apache iotdb, originated from Tsinghua, is building an open source ecological road
- 基於SSH的網上商城設計
- Six pictures show you why TCP has three handshakes?
- How to write a technical proposal
- Ardunio esp32 obtains real-time temperature and humidity in mqtt protocol (DH11)
- .NET ORM框架HiSql实战-第一章-集成HiSql
- 【义修换届大礼包】
- Post penetration file system + uploading and downloading files
猜你喜欢

自旋锁探秘

Redis (VIII) - enterprise level solution (I)

Solution: STM32 failed to parse data using cjson

Tubes响应性数据系统的设计与原理

Deep understanding of JVM (III) - memory structure (III)

Importing alicloud ECS locally to solve deployment problems

Solve the problem of unable to connect to command metric stream and related problems in the hystrix dashboard

Dropout: immediate deactivation

构建基本buildroot文件系统

4 years of working experience, and you can't tell the five communication modes between multithreads. Can you believe it?
随机推荐
Rainbow Brackets 插件的快捷键
TCP session hijacking based on hunt1.5
Only black-and-white box test is required for test opening post? No, but also learn performance test
Design and principle of tubes responsive data system
MSF后渗透总结
Distributed machine learning: model average Ma and elastic average easgd (pyspark)
Small tools (3) integration knife4j3.0.3 interface document
Map collection
4 years of working experience, and you can't tell the five communication modes between multithreads. Can you believe it?
基于SSM的新闻管理系统
If you want to learn software testing, you must see series, 2022 software testing engineer's career development
Three methods of modifying time zone in MySQL
[Netease Yunxin] playback demo build: unable to convert parameter 1 from "asyncmodalrunner *" to "std:: nullptr\u T"**
Inventory in the first half of 2022: summary of major updates and technical points of 20+ mainstream databases
编译生成busybox文件系统
每日面试1题-如何防止CDN防护被绕过
leetcode:787. The cheapest transfer flight in station K [k-step shortest path + DFS memory + defaultdict (dict)]
Post penetration file system + uploading and downloading files
腾讯持久化框架MMKV原理探究
NFT: 开启加密艺术时代的无限可能