开发者

VB.NET generates properties in the release build

开发者 https://www.devze.com 2023-01-01 12:50 出处:网络
I have a form and i drag and drop a control in VB.NET. I have a line say, private WithEvents radioButton RadioButton

I have a form and i drag and drop a control in VB.NET.

I have a line say,

private WithEvents radioButton RadioButton

Also, I have a handler like,

private void click(.....) Handles radioButton.Click
{
    ...
}

Now, When I build this is .NET 3.5 in release mode, and see the generate开发者_StackOverflow社区d code in reflector tool, the code is something like,

Private Overridable Property radioButton As RadioButton
.
.
.
<AccessedThroughProperty("radioButton")> _
Private _radioButton As RadioButton

Can someone tell me what is going on here? And how do I avoid the generation of new properties and fields?

-datte


The WithEvents/Handles construct is VB.NET syntax on top of the .NET Framework classes.
During the compilation process all language-specific keywords must be translated into the equivalent .NET Framework API calls, since that is what's available at runtime.

Related resources:

  • VB.NET WithEvents keyword behavior - VB.NET compiler restriction?
0

精彩评论

暂无评论...
验证码 换一张
取 消