// Declare a delegate
Public Delegate string addhandler (int A, string B); // you need to specify the number of parameters here. In this example, there are only two parameters.
Void calls asynchronous (){
Addhandler handler = new addhandler
I. Stack and stack
InProgramDuring runtime, its data is stored in the memory. WhileTypeDetermines how much memory a data item needs, where it is stored, and how it is stored. The running program uses two memory areas to store data-stack and heap.
Valid C #
Chapter 1 C # Language Elements
Item 1: Always use proPerties. Do not use accessible data members.Item 2: Always use readonly instead of Const.Item 3: Do not use forced conversion when type is changed. Use the is or as operator.Item 4: Use
Recently commissioned by C #, the documents and books on the Internet are summarized as follows:
The callback function is an important part of Windows programming. A callback function is actually a method call pointer and also a function pointer. It
It's also old.
Recently used
Record to avoid forgetting
To download an image, you must first have an image address.
To have an image address, you must first analyze the URL under the webpage
Two methods are generally used to download a webpage.
1.
1. Registry Introduction
Registry viewing toolRegedit.exe. The highest level mainly includes five keys.
There are also two hidden ones, which are generally not commonly used.
2. Registry operations
The. Net Operation registry mainly uses two
Preface: anonymous delegation refers to an anonymous method or Lambda expression.
A friend gave me a question last night:
In the following code, how can I output "Hello World"
1 If (--- enter the code ---)2 {3 console. Write ("hello ");4}5 else6 {7
1. Add the app. config file to the project:
Right-click the project name and select "add"> "Add new item". In the displayed "Add new item" dialog box, select "add application configuration file "; if the project has no configuration file before, the
Abstract modifier of the abstract class. Example: public abstract class name
Abstract classes cannot be instantiated.
An abstract class can be inherited. However, if an abstract class contains an abstract method (with an abstract modifier), the
Virtual functions are added before this function declaration.In this way, this function can be overwritten in its derived class (subclass ).
When the subclass overwrites the virtual function of the parent class, override must be explicitly added.
I. destructor
Destructor is used for destructor instances. That is, before the class instance is destroyed, the resources are cleared or the unmanaged resources are released. The following code example shows a class named car, which contains a class
I. Member Constants
1. Constants
A constant is an unchangeable value that is known during compilation and remains unchanged during the lifetime of the program. Constants are declared using the const modifier. Only C # built-in types (except system.
To enable an object to support the. NET serialization service, you must add the [serializable] feature to each associated class. If some members of the class are not suitable for serialization (for example, password fields), you can add the
The system. Threading. Interlocked class provides atomic operations for variables shared by multiple threads.
Provides atomic operations for integer classes
Experience shows that the resources that need to be protected under multiple threads are
Consider this scenario: a parking lot only contains a certain number of parking spaces, and only when there is space in the parking lot, the entry of the parking lot will open. C # provides the semaphore class to handle this scenario. The semaphore
Implicit local variables
C #3.0 provides a new keyword var. With this keyword, the compiler will deduce the Data Type of the variable based on the initial value used to initialize the local variable.
Sample Code:
Using system;Using system.
The functions of the monitor class are similar to those of the lock class:
1 System.Object obj = (System.Object)x; 2 System.Threading.Monitor.Enter(obj); 3 try 4 { 5 DoSomething(); 6 } 7 finally 8 { 9 System.Threading.Monitor.Exit(obj);10 }
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