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

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

      1. <legend id='ZnA3h'><style id='ZnA3h'><dir id='ZnA3h'><q id='ZnA3h'></q></dir></style></legend>
        <tfoot id='ZnA3h'></tfoot>
        • <bdo id='ZnA3h'></bdo><ul id='ZnA3h'></ul>
      2. DefaultMemberAttribute - 它有什么作用?

        DefaultMemberAttribute - what does it do?(DefaultMemberAttribute - 它有什么作用?)

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

                • <small id='ewaCu'></small><noframes id='ewaCu'>

                  <legend id='ewaCu'><style id='ewaCu'><dir id='ewaCu'><q id='ewaCu'></q></dir></style></legend>

                    <tbody id='ewaCu'></tbody>
                  本文介绍了DefaultMemberAttribute - 它有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已经阅读了有关它的 MSDN 文章.在内部,它似乎是 c# 设置将作为索引器工作的函数的方式(我对吗?).现在,我看到了以下示例:

                  I've already read the MSDN article about it. It seems internally it is the way c# sets which is the function that is going to work as indexer(am I right?). Now, I've seen the following example:

                  [DefaultMemberAttribute("Main")]
                  public class Program {
                  
                      public static void Main() {
                          ...
                      }
                  }
                  

                  现在,我不明白这是什么意思.

                  Now, I don't get it what it means.

                  谢谢大家.但是除了索引器之外,我仍然无法得到它的用处.我们什么时候调用 InvokeMember?

                  Thanks all. But I still can't get its usefulness, apart from the indexer thing. When are we going to call InvokeMember?

                  推荐答案

                  我个人没用过,但据我所知,你定义的是调用 InvokeMember.所以,如果我要说的话,使用你提供的代码片段:

                  I personally have never used it, but as far as I can tell you are defining the default method to be invoked when calling InvokeMember. So, using the code snippet you provided if I was to say:

                  Program prog = new Program();
                  typeof(Program).InvokeMember("", null, null, prog, null);
                  

                  因为我将 InvokeMember 调用的第一个参数留空,它将使用该属性来确定您的类的默认成员是什么,在您的情况下它是 Main.

                  Because I left the first argument empty of the InvokeMember call it would use the attribute to determine what the default member is of your class, in your case it is Main.

                  这篇关于DefaultMemberAttribute - 它有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Performance overhead of using attributes in .NET(在 .NET 中使用属性的性能开销)
                  Accessing attribute info from DTE(从 DTE 访问属性信息)
                  c# Hide a property in datagridview with datasource(c#使用数据源隐藏datagridview中的属性)
                  Extract Display name and description Attribute from within a HTML helper(从 HTML 帮助器中提取显示名称和描述属性)
                  How can I force the PropertyGrid to show a custom dialog for a specific property?(如何强制 PropertyGrid 显示特定属性的自定义对话框?)
                  Associate attribute with code generated property in .net(将属性与 .net 中的代码生成属性相关联)
                • <legend id='UEpcM'><style id='UEpcM'><dir id='UEpcM'><q id='UEpcM'></q></dir></style></legend>
                      <tbody id='UEpcM'></tbody>
                    <i id='UEpcM'><tr id='UEpcM'><dt id='UEpcM'><q id='UEpcM'><span id='UEpcM'><b id='UEpcM'><form id='UEpcM'><ins id='UEpcM'></ins><ul id='UEpcM'></ul><sub id='UEpcM'></sub></form><legend id='UEpcM'></legend><bdo id='UEpcM'><pre id='UEpcM'><center id='UEpcM'></center></pre></bdo></b><th id='UEpcM'></th></span></q></dt></tr></i><div id='UEpcM'><tfoot id='UEpcM'></tfoot><dl id='UEpcM'><fieldset id='UEpcM'></fieldset></dl></div>

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

                          <bdo id='UEpcM'></bdo><ul id='UEpcM'></ul>
                          <tfoot id='UEpcM'></tfoot>