是否有任何懒惰的方法列出所有的方法,只有throw new NotImplementedException();
在他们的身体…是Visual Studio c#内置的吗?类似于(Todo) Task List Pane
的东西,但它只会列出这种空抛出占位符方法,这些方法显然正在等待实现?
这将有助于实现接口和方便地跟踪事情。
您是否尝试过CTRL+SHIFT+F
和*.cs
文件搜索NotImplementedException
?
去对象浏览器( Ctrl + Alt + J )。
查找NotImplementedException
类。
右键单击并选择查找所有引用。
这是一个你可以使用的邪恶,但有效的技巧。在项目的某个地方添加以下类。只是要确保在将其发布到生产环境之前将其删除,或者使其与原始版本兼容。
namespace System
{
[Obsolete("Fix this")]
public class NotImplementedException : Exception
{
public NotImplementedException() : base() {}
public NotImplementedException(string message) : base(message) {}
public NotImplementedException(string message, Exception innerException) : base(message, innerException) {}
protected NotImplementedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) {}
}
}
这将导致代码中的所有notimplementeexception显示为警告。
这是源代码的类型拦截技术,我以前用过一两次。我通常不建议这样做,除非你真的知道自己在做什么。