[英]Hiding extension methods for certain generic types in IntelliSense
我有一个扩展方法:
public static void Foo<T>(this MyClass<T> target)
where T : IEnumerable
{
// Code goes here
}
我希望隐藏InteliSense中的这个扩展方法,如果T是一个字符串,但不是其他类型,就像使用字符串时隐藏Linq中IEnumerable的扩展方法一样。 我查看了EditorBrowsableAttribute
但它似乎不允许隐藏基于泛型类型的方法。
尝试将EditorBrowsableAttribute
放置到此方法(也可能放到包含此方法的类)并将方法重定位到另一个程序集(另一个项目)。 之后,编译程序集并卸载项目,因此您将只有DLL引用。 这是使用EditorBrowsableAttribute
的唯一方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.