ArticleDirectory
5. Extra articles-View registered customers
We are no stranger to mentioning events. events allow interactions between classes. It is based on delegation. With the prior understanding of delegation, I believe it will
In data type conversion, C # is stricter than other languages.
I. conversion rules: (you must know. Net)
C #Allows downward transformation in the inheritance chain, that is, any type can be implicitly converted to itsBase class type;
Introduction
The flags keyword allows us to use multiple combination values when using. Net enumeration variables.
Demo
1 [Flags]
2
Enum Weekdays
3 {
4
//
Note: Do not set Sunday to 0x0.
5
Monday =
0x1 ,
6
With Xiaojing reading CLR via C # (08)-Operator
We are no stranger to operators, such as binary operators such as +,-, *, and %, and ++ ,! . However, for non-primitive types, we need to use some custom methods to use these operators. Today I will
I have learned about parameters in recent days. In fact, I have learned about these parameters since I learned the basics of C language. However, I learned something carefully.
1. Name parameters and optional parameters
Named parameters
1. printersettings class
Printersettings:System. ObjectSystem. Drawing. Printing. printersettingsNamespace:System. Drawing. PrintingProgramSet:System. Drawing (in system. Drawing. dll)
Main methods and attributes
CLR cannot inherit multiple base classes, but can inherit multiple interfaces. Any instance that can use a named interface can use an instance of the interface type. Interfaces provide uniform names for a group of method signatures, but do not
5.In C #, a series of operators such as +,-, *,/, ++, --, and> can be reloaded, but operators such as + =,-= cannot be reloaded.
6.Note the short circuit operation. For example, if the first expression is false, the second expression is not
With Xiaojing, read CLR via C # (05)-access restrictions and data members
Today, I will share with you my knowledge about access restrictions and data members. It mainly includes the following two points:
Abstract, sealed, virtual, new, and
Blessed are lazy people -- vs code snippet editor snippeteditor can edit and create all vs code segments, including C # \ J # \ VB. NET.
This version supports not only vs2005, 2008, but also vs2010CodeSegment editing
Although the
• Extension method can be used to expand existing class functions so that instances of this type have more methods (functions ).
• The extension method only looks like a type method, but in essence it is not. It is more like a static method of the
You are welcome to test this.CodeAll the code of the generator has been completely rewritten, and there may be problems. I hope you can provide valuable comments.
If you do not understand the usage, contact me.
The main functions are as follows:
1
Technorati label: Extension Method
In practical applications, developers completeCodeAfter compilation, unless the changed code is re-compiled, it is difficult for developers to add new functions to the original code.
In C #3.0, a new
Principle of encapsulating objects
Inheritance
Polymorphism
Interface
Encapsulation is to hide the internal members and implementations of the class.
Benefits
Good encapsulation can reduce Coupling
Class internal
Several methods of class instantiation
1. New Keyword
2. Create method: there is no accessible constructor. The create method returns a reference to the class instance.
3. Reflection (reflection), for example, when using a plug-in
An
Using System; Using System. Windows. forms; Using St = system. Threading; Using SWF = system. Windows. forms; Using T = system. Diagnostics. Trace; Namespace Windowsformsapplication1 { Static Class Program { /// /// The main entry point
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service