C # Basic knowledge of the five

Source: Internet
Author: User

C # Basic knowledge of the five

Written by Zhu Zhu, please specify from Zhu Zhu Homeland http://blog.csdn.net/zhgl7688

1. Generate DLL files and reference other assemblies, example:http://blog.csdn.net/zhgl7688/article/details/41811597

2. Namespaces: Do not have the same name as the class or type; You can nest namespaces (nested, detached declarations).

3. Using directives: must be placed at the top of the source file before any type declarations.

4. Using alias directive: A type that is given to a namespace or namespace. Example: Using Sc=system.console.

5, the exception is a run-time error in the program, it violates a system constraint or application constraints, or the normal operation of unexpected circumstances. If the exception is not handled, the system suspends the program.

6. Try block contains: code for exception protection. Catch contains: The code that handles the exception. The finally block contains: code to be executed in all cases.

7. Throwing without an exception object can only be used inside a catch statement.

8. Structure differs from class: The class is a reference type and the structure is a value type, the structure is implicitly sealed and cannot be derived.

9, the struct is a value type, its variables cannot be null, and two struct variables cannot refer to the same object.

10, structure constructor: No parameter can not be declared in the program, there are parameters. A static constructor can be declared in a program. Destructors cannot be declared. Field initialization is not allowed.

11, structure can not be used modifier: protected, internal, abstract, virtual.

12. An enumeration is a value type like a struct, with only one type of member: A named integer value constant. Keyword enum.

13. [Flags] attribute: Notifies the enumeration member that a bit flag is used instead of as a value, which allows an enumerated tostring method to provide a more appropriate format for the value of the bit flag.

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

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

16. Delegate declaration: Start with delegate keyword, there is no method body.

17. Create a Delegate object: Declare it, create it later (create an expression with the new Operator's object, or just make a method specifier).

18. Combination delegate: Use the extra operator (Increase delegate + =, remove delegate-=) to "combine" to create a new delegate. Determines whether the invocation list of a delegate is empty by comparing the delegate to null.

19. Call delegate: The argument used to invoke the delegate will be used to invoke each method in the list.

20. Delegate with return value: The value returned by the last method in the invocation list is the value returned by the delegate invocation, and the return value of the other methods in the invocation list is ignored.

21. Delegate with reference parameter: The new value of the parameter is passed to the next method.

Written by Zhu Zhu, please specify from Zhu Zhu Homeland http://blog.csdn.net/zhgl7688

C # Basic knowledge of the five

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.