C# - 继承并使用通过子类实现的接口时,无法找到方法的使用 [英] C# - Can't find usage of method when inherited and used through an interface implemented by the subclass
本文介绍了C# - 继承并使用通过子类实现的接口时,无法找到方法的使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用VisualStudio的2008年和2010年,都与ReSharper的,当我尝试,查找一个给定的方法,我没有得到任何结果的惯例,尽管该方法的继承,然后通过所谓的接口。怎么了?那是一个VS / ReSharper的错误?
见下面的例子:
I'm using VisualStudio 2008 and 2010, both with ReSharper, and when I try to lookup for usages of a given method I get no results, despite the method being inherited and then called through an interface. What's wrong? Is that a VS/ReSharper bug? See the example below:
using System;
namespace UsageNotFound
{
interface MyInterface
{
void Hello();
}
class SuperClass
{
public void Hello() //NOTE: VS 2008/2010 (with resharper)
seems unable to find usages on this!!!
{
Console.WriteLine("Hi!");
}
}
class SubClass : SuperClass, MyInterface
{
public static MyInterface GetInstance()
{
return new SubClass();
}
}
class Program
{
static void Main(string[] args)
{
SubClass.GetInstance().Hello();
}
}
}
谢谢,
法布里奇奥
Thanks, Fabrizio
推荐答案
这是一个已知的问题:的 http://youtrack.jetbrains.net/issue/RSRP-46273 没有当前目标修复版本
This is a known issue: http://youtrack.jetbrains.net/issue/RSRP-46273 with no current target fix version
这篇关于C# - 继承并使用通过子类实现的接口时,无法找到方法的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文