From: http://hi.baidu.com/super311/blog/item/15ff2513ed83f4d3a6866945.html
Delegate statement
Public delegate void MyDelegate (string str );Note1. The definition of delegation is similar to the definition of method, but a delegate is added before, but the delegate is not a method, and it is a type. It is a special type
Root U3D-about all aspects of Delegate, u3d-delegate
Do I need to read this article?
Code1:
1 private delegate void BloodNumDelegate ();2 3 public delegate void ExpNumChangeDelegate (int _currentExpNum);4 5 public event ExpNumChangeDelegate mOnExpNumChangeDelegate;
Code2:
PlayerVoProxy. instance. mOnExpNumChangeDelega
Today, there is a netizen, ask:
There are several small text files in the specified directory, and you now need to use multithreading for reading.
A file can be a thread or set of 10 threads in a way.
Append all the read text to the specified edit box in the window, and only one edit box is written in this, in this case, in the order of wrapping.
I wrote the following solution in the form of a delegate:
Using System;Using System.Collections.Gener
Bind method to delegate
Through the example of (1), is there a dream? So, are you wondering: In the above example, I don't have to assign a value to the name parameter directly in the greetpeople () method. I can use the variable like this:
Static void main (string [] ARGs ){String name1, name2;Name1 ="Jimmy";Name2 ="Half smoke";
Greetpeople (name1, englishgreeting );Greetpeople (name2, chinesegreeting );Console. readkey ();}
Since the same st
Speaking of delegates, some people who are just getting started in C # feel very tall and have no contact, but in fact a lot of people have used lambda expression, in fact, lambda expression is a delegate.About the introduction of a delegate there's a great God written in detail: Zhang Ziyang's blog in C # for delegates and events-Part.1. Follow Simin's understanding of the introduction of the commissioning1. What is a
Original article: http://www.cnblogs.com/xcj26/p/3536082.html
These are common things for the older generation of programmers. They are nothing new, but they are full of charm for the new generation of programmers. Many applications, such as delegation and Expression Tree, can be mastered only after long learning, understanding, and practice. Today, I try to describe it in a simple way, so that you can read this blog within five minutes.
First minute: Deleg
Before reading the following knowledge, I already think you already have C # Foundation, including simple delegate knowledge; Code is developed using VS2008, but will be written in the. Net Framework 2.0 (C Sharp)
What is. NET asynchronous mechanism?
Before we explain this topic, let's look at the synchronized program, which is our usual Hello World program.
Code 1:
1 class Program
2 {
3 static void Main (string[] args)
4 {
5//view current thread
C # commissioned the basic series was originally published in February 2011 in my Sina blog, now it will be like this blog.
Multi-Channel delegation
Class Program {public delegate void Saythingtos (string s);
void SayHello (String s) {Console.WriteLine ("Hello {0}", s);
} void Saygoodbye (String s) {Console.WriteLine ("Goodbye {0}", s);
} static void Main (string[] args) {//mode one Saythingtos say1, Say2, Say3, Say4;
C # delegate introduction (delegate, Action, Func, predicate ),A delegate is a class that defines the type of a method so that the method can be passed as a parameter of another method. An event is a special delegate.
1. Delegate statement
(1).
Original: http://www.cnblogs.com/zhangchenliang/archive/2012/09/19/2694430.htmlFirst, the beginning of repentanceMy best programming language in C #, I want to say sorry to you, because I have so far understood how delegate and event in C # are used, ashamed of it. Well, today, take advantage of the black and dark night to talk about the simple usage of delegate and event, hoping to bring help to beginners.
Recently, I spoke to the project team and met some students who have just graduated from school. I claim to be proficient or even proficient in C #. At the beginning, every time I read my resume that says "proficient in C #", I feel an inexplicable excitement. However, the results are often disappointing. After several such experiences, I found that some resumes have too much moisture, and most of them are really skilled, but not C #, but C ++. In other words, what they are "proficient" is the p
First, the Commission:The completion of a delegate should be in three steps:STEP01: First define a delegate with delegate;public delegate int Calculatoradd (int x, int y);STEP02: Declares a method to correspond to a delegate.public int Add (int x, int y){return x + y;}protected void Frmtest_load (object sender, EventAr
Delegate, Lambda expression, event series 03, from delegate to Lamda expression, lambdalamda
In the article "delegate, Lambda expression, event series 02, and when to use delegate", the use of delegate makes the code much simpler.
namespace ConsoleApplication2{ internal
Delegate (2): use events to encapsulate delegate variables and
Next article: Delegation (1): Delegation and Methods
We often see this code when studying the design pattern:
It can be said that delegation and events are often used together, and it is quite troublesome. In addition, I think the delegation is quite good. Why should I join the event? It's complicated. OK. Here is a small example to il
[. NET Basics]-delegate, event, thread (1),. net delegate1. Delegation is the list of pointers for storing methods, that is, the container for loading methods.
A. Create A winform project [01 Delegate]. Add the dg_SayHi.cs delegate class to the Project for storage methods.
Namespace _ 01 delegate {// define
In the custom delegate implementation, check whether the delegate has implemented the @ protocol method to respond.
In the custom delegate implementation, we will determine whether the delegate is empty. If not, we will call the corresponding delegate function:
Example: if (
Delegate and event (1), delegate eventI personally think that the most important essence of c # is its delegation.
To be honest, it is now the era of c #5.0, and c #6 will soon come out. As a c #1 delegate, it has long been encapsulated by more advanced tools such as generic delegation and lambda expressions. Basically, few people declare a
9. Delegate, event, Lambda, and delegate event lambda
There must be a problem with delegation.The first question is what is delegated? Look at the description in. net: On the. net platform, the delegate type is used to define and callback in the corresponding application. (Callback? A technique used to process two physical bidirectional communication in the memor
PanPen120 on CSDN original, such as other sites reproduced please pay attention to the layout and the source:Research commissioned, because there is the basis of function pointers, but also easy to get started, but for some concepts and practices, always to make it very clear and tangled, these several commissioned articles I was combined with the "C # and. NET4 Advanced Program Design", MSDN, draw on other people's blog summary discourse, With the most direct and concise words to clarifyKey wor
PHP design mode delegate mode, PHP design mode delegate
The delegation mode is a basic technique in software design pattern. In delegate mode, there are two objects involved in processing the same request, and the object that accepts the request delegates the request to another object for processing. The delegate mode
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.