简体   繁体   English

隐藏从intellisense继承的一些方法

[英]Hide some inherited methods from intellisense

I've created a UserControl. 我创建了一个UserControl。 Let's imagine that code: 让我们想象一下代码:

public class MyUserControl : UserControl
{
  Button button1;
  Button button2;

  //...
}

With that UserControl i can click on one of the buttons and this fires some events ( Button1Clicked , Button2Clicked ). 使用该UserControl,我可以单击其中一个按钮,这会引发一些事件( Button1ClickedButton2Clicked )。

Now with the UserControl there are some other events, but i never use that events like MouseMove or Dragging ( DragEnter , DragLeave , DragOver , ...). 现在有了UserControl,还有一些其他事件,但是我从不使用过MouseMove或Dragging( DragEnterDragLeaveDragOver ,...)之类的事件。 Intellisense shows a huge list of events that are useless in my UserControl. Intellisense显示了大量事件,这些事件在我的UserControl中没有用。

Is there a common way to hide those inherited events? 有隐藏这些继承事件的通用方法吗? My main reason is intellisense but also documentation (XML-summaries). 我的主要原因是智能感知,也有文档(XML摘要)。

As the comments reveal: No, there is no way to hide inherited events from Intellisense. 正如评论所揭示的:不,没有办法隐藏Intellisense的继承事件。

It is probably a bad decision too. 这可能也是一个错误的决定。 If there would be a way, what if you forgot to unhide it when you implement it? 如果有办法,在实现时忘记取消隐藏该怎么办? Nobody would see that method but it would be there and if you type it, it would work. 没有人会看到这种方法,但是它会在那里,如果您键入它,它将起作用。 That would be a little bit odd. 那有点奇怪。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM