[C #] Chapter 1 learning points (1) -- Overall understanding,
Category: C #, VS2015
Created on:
Teaching materials used: (12th Five-Year Plan teaching materials) C # program design and application tutorial (version 3rd)
1. Simplify your coding workload by using classes already designed by others
When you want to deal with a bunch of messy things, you need to make it organized, first, we need to "divide it into several major parts" (divided into different "namespaces" or "packages "), then, "classify" each part (multiple classes may exist in each namespace), and finally implement the functions of each class one by one ).
But how do you use code to describe these "categories? You must first differentiate whether you are describing the category. This is the purpose of the class keyword. Of course, you have to give each category a special name, otherwise you still cannot tell which category is described.
After classification, you can use the code to describe the functions to be implemented in the class.
In general, the basic processing method of object-oriented programming is: for businesses that can be completed in a class that are successively associated, the Code (structured program design) is implemented one by one in sequence in the specified class ). For businesses that are not associated in sequence, multiple individuals (multiple methods in multiple classes) are arranged to perform (multi-thread and multi-process) at the same time ).
Who arranged it? It's you. Who is responsible for executing the tasks you have arranged? Is the operating system.
2. What namespaces are included in the. NET Framework
. The. NET Framework has already helped you define tens of thousands of classes to help you simplify coding, when installing VS2015, these classes have all been installed on your machine and allocated to different dll files. In each dll file, and allocate the classes to different namespaces, most of what you do is to use the using command to reference the namespace you know (as for which dll file you do not need to consider ,. NET Framework will automatically help you do this ). Therefore, you must first understand the namespaces in the. NET Framework.
After you add a reference to the namespace, you can directly use the classes contained in the namespace to implement the business logic you want to process.
To understand which namespaces are available in the. NET Framework, follow these steps:
(1) Run VS2015, create a project, and select a template, for example, select a console application.
(2) select View> Object Browser on the main menu, and you will see the namespace that you can directly reference in the console application.
For example, expand the System namespace under mscorlib, you will see the Console class, click it, you will see the various methods contained in the class, click a method, you will see its explanation. As shown in:
You must learn to use this method to find what you need. Have you seen it? The teaching material tells you only the several classes and methods that are most commonly used. In actual projects, they are far more than used. Only in this way can you tell the opposite, rather than being taught by others.
3. Learning Open-source architecture broaden your thinking
Except. in addition to the built-in classes of the. NET Framework, there are quite a few open-source architectures on the Internet (including many classes) that are well designed to analyze the source code of these architectures, learn the basic design ideas of these architectures, gradually broaden your horizons, and then turn it into your own ideas, which is the right way, rather than directly using people's source programs for projects. The reason is very simple. No matter which company, open-source things are carefully filtered by developers, and filtered out is precisely the most critical part of the project-"performance" and advanced features. In other words, people just want to tell you the basic implementation ideas through open-source code. In the end, they are just a marketing strategy of "please join us". If all the core code is open-source, isn't the company of that person's family eaten long ago by unscrupulous companies that only steal others' achievements.
IBM, Microsoft, HP, Apple, Google ,......, All companies do this. There are both open-source things (not money, but limited functions and performance) and unopen-source things (for money, all functions are available, performance is not limited ). Therefore, do not emphasize only one aspect of a company in order to boast its own opinion, but only another aspect of a company in order to attack others' opinions, it's not good to see the competition on the Internet all day. Isn't it all about what American companies have given you.
No matter how hard it is, people directly use open source programs for project results. At best, it is just a heel. The difference is just who is the ass.
Remember: "Open-source", "free", are the sugar that others give you a taste of for your learning. Don't treat it as a meal. In other words, you can understand what the target is during the learning period. I only know one of them. I don't know the other. What you say is nothing, and no one else will agree with you.
Iv. Key points of this Chapter
1. Learn to define your own class)
2. Learn to define your own structure (struct)
3. master the basic usage of attributes
4. master the basic usage of the Method
5. Understand the basic concepts and usage of events
6. Understand the encapsulation, inheritance, and Polymorphism of classes.
7. Understand how to use images as objects (Advanced content)
8. master the basic usage of Date and Time Processing
9. Basic usage of random numbers
10. master the basic usage of the timer
11. master the basic usage of basic mathematical operations
V. Examples in this Chapter
An example of the source program (VS2015) in this chapter is as follows:
Some of the operations in the supplementary example are as follows (to help you understand how to use inheritance to implement complex functions ):