• <bdo id='qcpRy'></bdo><ul id='qcpRy'></ul>
  1. <legend id='qcpRy'><style id='qcpRy'><dir id='qcpRy'><q id='qcpRy'></q></dir></style></legend>
  2. <tfoot id='qcpRy'></tfoot>
  3. <i id='qcpRy'><tr id='qcpRy'><dt id='qcpRy'><q id='qcpRy'><span id='qcpRy'><b id='qcpRy'><form id='qcpRy'><ins id='qcpRy'></ins><ul id='qcpRy'></ul><sub id='qcpRy'></sub></form><legend id='qcpRy'></legend><bdo id='qcpRy'><pre id='qcpRy'><center id='qcpRy'></center></pre></bdo></b><th id='qcpRy'></th></span></q></dt></tr></i><div id='qcpRy'><tfoot id='qcpRy'></tfoot><dl id='qcpRy'><fieldset id='qcpRy'></fieldset></dl></div>

      <small id='qcpRy'></small><noframes id='qcpRy'>

      .NET 委托类型的正确命名约定?

      Proper naming convention for a .NET Delegate type?(.NET 委托类型的正确命名约定?)

      <small id='wzJWX'></small><noframes id='wzJWX'>

        <tfoot id='wzJWX'></tfoot>
        • <bdo id='wzJWX'></bdo><ul id='wzJWX'></ul>

            <i id='wzJWX'><tr id='wzJWX'><dt id='wzJWX'><q id='wzJWX'><span id='wzJWX'><b id='wzJWX'><form id='wzJWX'><ins id='wzJWX'></ins><ul id='wzJWX'></ul><sub id='wzJWX'></sub></form><legend id='wzJWX'></legend><bdo id='wzJWX'><pre id='wzJWX'><center id='wzJWX'></center></pre></bdo></b><th id='wzJWX'></th></span></q></dt></tr></i><div id='wzJWX'><tfoot id='wzJWX'></tfoot><dl id='wzJWX'><fieldset id='wzJWX'></fieldset></dl></div>

                <tbody id='wzJWX'></tbody>
                <legend id='wzJWX'><style id='wzJWX'><dir id='wzJWX'><q id='wzJWX'></q></dir></style></legend>
              1. 本文介绍了.NET 委托类型的正确命名约定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                按照惯例,类通常命名为名词,方法命名为动词,接口命名为形容词.

                By convention classes are often named like nouns, methods like verbs and interfaces like adjectives.

                委托的通用命名约定是什么?或者当代表在类型和其他事物中列出时,有什么好方法来区分其名称?

                What is the common naming convention for a delegate? Or what's a good way to differentiate its name when delegates are listed among types and other things?

                我的直接假设是将委托命名为更可能是一个形容词,因为单个方法接口通常可以替换为委托.

                My immediate assumption is to name a delegate more likely an adjective because a single method interface can often be replaced with a delegate.

                一些想法:

                delegate object ValueExtracting(object container);
                
                delegate object ValueExtractor(object container);
                
                delegate object ValueExtractionHandling(object container);
                
                delegate object ValueExtractionHandler(object container);
                

                推荐答案

                我个人使用了几种不同的模式:

                Personally I use a couple of different patterns:

                [Task][State]Handler - UITaskFinishedHandler

                [Event]Handler - ControlLoadedHandler

                [Function Name]Delegate - DoSomeWorkDelegate - 当我需要创建委托以在不同/新线程上调用函数时使用

                [Function Name]Delegate - DoSomeWorkDelegate - used when I need to create a delegate for calling a function on a different/new thread

                [Task]Callback - ContainerLoadedCallback - 当控件 A 开始一个动作时使用,该动作由控件 B 完成大部分工作并且控件 A 已将依赖项传递给控件 B(即 ControlA 可能已经传递了一个 UI 容器供 ControlB 填充,并且需要通知才能实际显示该容器)

                [Task]Callback - ContainerLoadedCallback - used when control A starts an action which control B does most of the work and control A has passed a dependency in to control B (i.e. ControlA may have passed a UI container for ControlB to fill and needs notification to actually show the container)

                当您有一个使用大量多线程或异步 WCF 调用的项目时,最终可能会出现大量委托,因此采用至少对您有意义的标准非常重要.

                When you have a project that uses a lot of multi threading or async WCF calls you can end up with a lot of delegates floating around, so it is important to adopt a standard that at least makes sense to you.

                这篇关于.NET 委托类型的正确命名约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)
                How to store delegates in a List(如何将代表存储在列表中)
                How delegates work (in the background)?(代表如何工作(在后台)?)
                C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)
                Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)
                Func Delegate vs Function(函数委托与函数)

                  <tfoot id='Tut5R'></tfoot>

                    1. <legend id='Tut5R'><style id='Tut5R'><dir id='Tut5R'><q id='Tut5R'></q></dir></style></legend>
                        <tbody id='Tut5R'></tbody>
                      • <bdo id='Tut5R'></bdo><ul id='Tut5R'></ul>

                          <small id='Tut5R'></small><noframes id='Tut5R'>

                        • <i id='Tut5R'><tr id='Tut5R'><dt id='Tut5R'><q id='Tut5R'><span id='Tut5R'><b id='Tut5R'><form id='Tut5R'><ins id='Tut5R'></ins><ul id='Tut5R'></ul><sub id='Tut5R'></sub></form><legend id='Tut5R'></legend><bdo id='Tut5R'><pre id='Tut5R'><center id='Tut5R'></center></pre></bdo></b><th id='Tut5R'></th></span></q></dt></tr></i><div id='Tut5R'><tfoot id='Tut5R'></tfoot><dl id='Tut5R'><fieldset id='Tut5R'></fieldset></dl></div>