我们为什么要使用委托人? [英] Why do we use delegates?

查看:113
本文介绍了我们为什么要使用委托人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们为什么使用委托人,主要作用是什么?我已经准备了2个Web表单,在每个表单中都准备了一个文本框.通过使用委托,如果我在一个文本框中编写任何内容,它将以另一种形式反映在其他文本框中-可能吗?

谢谢!

Why we use delegates and what is the major role? I have taken 2 web forms and in each form I have taken one textbox. By using delegates if I write any thing in one text box it will reflect on other textbox in another form - is it possible?

Thanks!

推荐答案

在问这样的问题之前,您应该先搜索Google/Bing. MSDN中有一个全面的文档,另外还有许多其他带有示例的文章/教程.
You should search Google/Bing before you ask such question. There is a comprehensive documentation in MSDN, plus there are so many other articles/tutorials with examples.
Start here[^]!


要了解与会代表,您应该首先尝试阅读一些与向您解释这个概念.
To understand delegates, you should first try and go through some books that explain the concept to you.


请查看此讨论,以了解所涉及的内容:
C#.NET中的委托的优点是什么? [ ^ ].

另请参见:
传递以N个参数为参数的方法在C# [ ^ ].

与事件结合使用:
如何在特定按钮单击时调用keydown事件 [ ^ ],
[已解决]如何为C#控件添加事件 [ ^ ].

—SA
Please see this discussion, just for a general view on what''s involved:
What are the advantages of delegates in C#.NET?[^].

See also:
Pass a method with N params as parameter in C#[^].

Using in connection with events:
how to call keydown event on particular button click[^],
[Solved] How to add Event for C# Control[^].

—SA


这篇关于我们为什么要使用委托人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆