Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# VSTO应用程序的接口实现。工厂类缺少方法_C#_Visual Studio_Interface_Vsto_Office Addins - Fatal编程技术网

C# VSTO应用程序的接口实现。工厂类缺少方法

C# VSTO应用程序的接口实现。工厂类缺少方法,c#,visual-studio,interface,vsto,office-addins,C#,Visual Studio,Interface,Vsto,Office Addins,我正在阅读由MicrosoftVisualStudioToolsforOffice(VSTO)框架生成的C#代码,遇到了一个我不理解的案例。我将其简化如下(我省略了方法参数): ThisAddIn构造函数是由位于designer.cs文件中的VSTO自动生成的代码。它被传递一个参数(factory),该参数实现ApplicationFactory接口。使用F12,我跟踪了界面,如图所示。作为回报,该接口继承了Tools.Factory接口,我也列出了该接口 我不明白的是:当我在编辑器中为Glob

我正在阅读由MicrosoftVisualStudioToolsforOffice(VSTO)框架生成的C#代码,遇到了一个我不理解的案例。我将其简化如下(我省略了方法参数):

ThisAddIn
构造函数是由位于designer.cs文件中的VSTO自动生成的代码。它被传递一个参数(
factory
),该参数实现
ApplicationFactory
接口。使用F12,我跟踪了界面,如图所示。作为回报,该接口继承了
Tools.Factory
接口,我也列出了该接口

我不明白的是:当我在编辑器中为
Globals.Factory
变量(如下所示)触发IntelliSense时,我只看到两个接口中列出的八种方法中的五种(在代码列表中注释为OK)。
Tools.Factory
接口中三个方法的实现缺失(在代码列表中注释为缺失)。为什么会这样


注意:代码工作正常。

有一些属性,例如
EditorBrowsable
,可以对设计器和IntelliSense隐藏方法和属性


在这种情况下,所提到的方法存在并且可以调用,但是它们是隐藏的。

您可以调用这些方法吗?有一些属性可以让你简单地对IntelliSense隐藏一些东西,比如
EditorBrowsable
@Zer0你是对的!我能够调用缺少的方法。请作为答案发布,我会接受。@Zer0事实上,缺少的方法被标记为
[EditorBrowsable(editorbrowseblestate.Never)]
,我完全忽略了它,因为我以前从未见过它。你真是个天才
public interface Tools.Factory
{
    RibbonFactory GetRibbonFactory();   // OK
    AddIn CreateAddIn(...);                                         // Missing
    CustomTaskPaneCollection CreateCustomTaskPaneCollection(...);   // Missing
    SmartTagCollection CreateSmartTagCollection(...);               // Missing
}

public interface ApplicationFactory : Tools.Factory
{
    SmartTag CreateSmartTag(...);       // OK
    Action CreateAction(...);           // OK
    Document GetVstoObject(...);        // OK
    bool HasVstoObject(...);            // OK
}   

public ThisAddIn(ApplicationFactory factory, IServiceProvider serviceProvider) : 
        base(factory, serviceProvider, "AddIn", "ThisAddIn")
{
    Globals.Factory = factory;
}