C #5. Basic Knowledge,

Source: Internet
Author: User

C #5. Basic Knowledge,

C #5. Basic Knowledge

Prepared by Zhu, reproduced please indicate from Zhu jiayuan http://blog.csdn.net/zhgl7688

1. generate DLL file and reference other assembly, example: http://blog.csdn.net/zhgl7688/article/details/41811597

2. namespace: do not name the same as the class or type. You can nest the namespace (original nesting and separation Declaration ).

3. Using command: It must be placed at the top of the source file before any type declaration.

4. Using alias command: indicates the type of a namespace or namespace. For example, using SC = system. console.

5. An exception is a running error in the program. It violates a system constraint or application constraint, or is unexpected during normal operations. If the exception is not handled, the system suspends the program.

6. Try contains the code for exception protection. Catch contains: code for handling exceptions. Finally block contains the code to be executed in all circumstances.

7. Throws without exception objects can only be used in Catch statements.

8. Differences between structure and class: the class is a reference type, the structure is a value type, and the structure is implicitly sealed and cannot be derived.

9. The structure is a value type, and its variable cannot be null. Two Structure Variables cannot reference the same object.

10. Structure constructor: If there is no parameter, it cannot be declared in the program. If there is a parameter, it is acceptable. Static constructors can be declared in the program. The Destructor cannot be declared. Field Initialization is not allowed.

11. The structure cannot contain modifiers: protected, internal, abstract, and virtual.

12. enumeration is a value type like a structure. Only one type of member is allowed: The named integer constant. Keyword enum.

13. [Flags] feature: the notification enumeration member is a bit flag instead of a value. It allows the ToString method of an enumeration to provide more appropriate formatting for the value of the counterpoint flag.

14. The same enumeration can be compared, and different enumeration cannot be compared with each other.

15. Delegate: contains a list of ordered methods with the same signature and return value types. It is object-oriented and type-safe. The method in the call list can be an instance method or a static method.

16. delegate statement: It starts with the delegate keyword and has no method subject.

17. Create a delegate object: declare the object first, and then create it (create an expression using the object of the new operator or use only the method specifier ).

18. Combined delegation: use additional operators (add delegate + =, remove delegate-=) to "combine" and create a new delegate. Compare the delegate with Null to determine whether the delegate call list is empty.

19. Call delegate: parameters used to call a delegate are used to call each method in the list.

20. Delegate with return values: the value returned by the last method in the call list is the value returned by the delegate call. The return values of other methods in the call list are ignored.

21. Delegate with reference parameters: the new value of the parameter will be passed to the next method.

Prepared by Zhu, reproduced please indicate from Zhu jiayuan http://blog.csdn.net/zhgl7688

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.