在用户控件实现Dispose(布尔) [英] Implement Dispose(bool) on a UserControl

查看:280
本文介绍了在用户控件实现Dispose(布尔)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在用户控件执行的Dispose(布尔)......当VS设计已经实现了它与 DebuggerNonUser code 属性?请问我的修改,这种方法去除?

($ C $从UserControl.Designer.vb C)

 < System.Diagnostics.DebuggerNonUser code()> _
受保护的覆盖子的Dispose(BYVAL处置作为布尔)
 

解决方案

您需要从设计器文件中删除处置方法,并将其添加到您的源文件。< BR> 你或许应该也删除 DebuggerNonUser code 属性。

至少在C#中,设计师将不会自动把处置返回到设计文件,如果VB的设计师做了我会感到震惊。

How to implement the Dispose(boolean) at a UserControl... when the VS Designer already implemented it with a DebuggerNonUserCode attribute? Will my modifications on this method removed?

(code from UserControl.Designer.vb)

<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)

解决方案

You need to remove the Dispose method from the designer file and add it to your source file.
You should probably also remove the DebuggerNonUserCode attribute.

At least in C#, the designer will not automatically put the Dispose back into the designer file, and I'd be shocked if the VB designer did.

这篇关于在用户控件实现Dispose(布尔)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆