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?
精彩评论