基于“使用”而不是继承的IntelliSense

时间:2013-11-06 10:43:44

标签: c# visual-studio

在下面的屏幕截图中,编译器和IntelliSense显示除非我取消注释using语句,否则program实例不是SatisfyImportsOnce的有效参数。据我所知,它不是基于基类/接口/隐式转换的匹配签名,并且都有相关的引用,所以它是如何知道的?这个using检查是什么,它是如何工作的?

http://i.imgur.com/3BPpXew.png

enter image description here

1 个答案:

答案 0 :(得分:3)

如果没有using,编译器只会在System.ComponentModel.Composition.Hosting命名空间中找到this method,只需ComposablePart个参数

通过使用,它还会找到this extension method,其中包含object参数。