<bdo id='9qWRR'></bdo><ul id='9qWRR'></ul>

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

      1. <small id='9qWRR'></small><noframes id='9qWRR'>

        将 helpstring 属性应用于通过 COM 接口公开的 C# 属性

        Getting the helpstring attribute applied to C# properties exposed via COM interfaces(将 helpstring 属性应用于通过 COM 接口公开的 C# 属性)
        1. <tfoot id='2nhuz'></tfoot>

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

                <bdo id='2nhuz'></bdo><ul id='2nhuz'></ul>

                  <small id='2nhuz'></small><noframes id='2nhuz'>

                  本文介绍了将 helpstring 属性应用于通过 COM 接口公开的 C# 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我目前正在开发一个库,该库将公开给 COM,以便在升级的旧项目中使用.我正在创建要公开的接口,它们具有 long、int 等类型的属性.使用 DescriptionAttribute,我可以获得在 .tlb 中为接口、类和方法生成的帮助字符串,但由于某种原因,它似乎不想为属性工作.无论如何要获得在 TLB 输出中为属性生成的帮助字符串吗?

                  I'm currently working on a library that's to be exposed to COM for use in a legacy project that's being upgraded. I'm creating interfaces that are to be exposed, and they have properties on them with long, int, etc types. Using the DescriptionAttribute, I can get helpstrings generated in the .tlb for interfaces, classes, and methods, but for some reason it doesn't seem to want to work for properties. Is there anyway to get a helpstring generated in the TLB output for properties ?

                  推荐答案

                  你必须将属性分别放在getter和setter上.像这样:

                  You have to put the attribute on the getter and setter individually. Like this:

                  using System;
                  using System.ComponentModel;
                  using System.Runtime.InteropServices;
                  
                  namespace ClassLibrary1 {
                      [ComVisible(true), InterfaceType(ComInterfaceType.InterfaceIsDual)]
                      public interface IFoo {
                          int property {
                              [Description("prop")]
                              get;
                              [Description("prop")]
                              set;
                          }
                      }
                  }
                  

                  重复描述很笨拙,但在 IDL 中也是必需的.

                  Repeating the description is clumsy, but also required in IDL.

                  这篇关于将 helpstring 属性应用于通过 COM 接口公开的 C# 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 帮助器中提取显示名称和描述属性)
                  C# Attributes and their uses(C# 属性及其用途)
                  C# - Getting all enums value by attribute(C# - 按属性获取所有枚举值)
                  • <small id='gPoe7'></small><noframes id='gPoe7'>

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

                          <tfoot id='gPoe7'></tfoot>
                          <legend id='gPoe7'><style id='gPoe7'><dir id='gPoe7'><q id='gPoe7'></q></dir></style></legend>
                          • <bdo id='gPoe7'></bdo><ul id='gPoe7'></ul>