Re: C# or VB.NET?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



VB event wiring is better (withevents),
WithEvents is totally unnecessary in C#, otherwise it would have it:
http://www.thescripts.com/forum/thread255585.html

Also, I guess VB doesn't need WithEvents/Handles either since it supports both the C# manual += adding of events (via AddHandler... remember to remove it too at some point!) AND a cleaner "declarative" WithEvents / Handles way.

Private Sub Button1_Click(...) Handles Button1.Click
....
End Sub
or (to similate old school VB control arrays)
Private Sub Buttons_Click(...) Handles Button1.Click, Button2.Click, Button3.Click
....
End Sub

No need to tear down the event handler either.

"Mark Rae [MVP]" <mark@xxxxxxxxxxxxxxxxx> wrote in message news:%23v6EaX4UIHA.4752@xxxxxxxxxxxxxxxxxxxxxxx
"CMoya" <moy@xxxxxxxxxx> wrote in message news:5BBFD0DB-D307-4890-80C2-B4C4F9821DC8@xxxxxxxxxxxxxxxx

I disagree with you. Although I like C#, it's only because of a sense of cachet that it gives you that you probably feel the way you do (because of the fuzzy feeling you get when you think it's somehow related to C++ in some way-- when really it's not).

Not true at all - I've never used C/C++ at all in my entire career...

Aside from C#'s pointer and rudimentary unmanaged code ability

You mean unsafe code, not unmanaged code...

VB event wiring is better (withevents),

WithEvents is totally unnecessary in C#, otherwise it would have it:
http://www.thescripts.com/forum/thread255585.html

Asc

http://www.thescripts.com/forum/thread441566.html

Left, Mid

http://www.thescripts.com/forum/thread246103.html

Now, you're perfectly welcome to prefer the C# syntax. But in terms of functionality VB is not "identical" to C#... it's better.

We'll have to agree to disagree... :-)


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

.


Quantcast