Re: Registering Event Handlers in C# vs. VB .NET

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You've missed my point. I'm not saying VB.NET doesn't offer the same
functionality possible elsewhere. I'm saying that the "Handles" keyword
is used in a way that obscures the full capabilities of events. A
particular example of what I mean is the requirement that when using
"Handles" that you have some known object variable (as opposed, for
example, to a collection of objects exposing an event), and of course the
ability to subscribe and unsubscribe at will at run-time.

It's not that you can't do these things in VB.NET, but you have to use an
entirely different syntax to do so from the syntax offered up as the basic
provided mechanism.

I didn't miss your point, but I think that your point doesn't apply as
broadly as you make it sound. If I am developing my own classes and raising
my own events, then the client of these classes won't have any "provided
mechansim" for handling those events. It will be up to the client to
declare the instance "WithEvents" or "AddHandler". I think what you are
referring to is applicable to classes used in UI's, but then (as I said),
they can still be modified to use the other syntax.

I just don't think this is a VB thing. C# also has language elements, such
as "using" that abstract a feature into a new language construct, but the
user can still get at this language functionality in other ways.

Anyway, thanks for your input.

-Scott


.



Relevant Pages

  • Re: New bytecode assembly language to play with
    ... language that looks familiar, something I could probably figure out quite ... about a bit of superficial syntax here. ... The wheel has been reinvented several times. ... one that introduces new functionality, i.e. it's not just another way ...
    (comp.lang.misc)
  • Re: INSPECT and TRAILING syntax
    ... adding new syntax is a POST-2002 development. ... '02 Standard was that it was simply "TOO BIG". ... COULD already be accomplished and did the language really need them. ... the syntax for that functionality is pretty straightforward -- adds ...
    (comp.lang.cobol)
  • Re: New bytecode assembly language to play with
    ... learn the language very quickly, and can even guess at syntax without ... When I said "syntax isn't important" I didn't mean "syntax isn't ... one that introduces new functionality, i.e. it's not just another way ... pick a syntax that a large proportion of programmers are ...
    (comp.lang.misc)
  • Re: Pythons "only one way to do it" philosophy isnt good?
    ... is its elegant and readable syntax. ... is that a programming language can't provide ... off-the-shelf an elegant syntax for all functionality that will ever ...
    (comp.lang.python)
  • Re: Looking for volunteers for XL
    ... the form of a notation in an extensible language ... Similarly, in XL, tree rewrites are easily ... XL does not encourage syntax changes. ...
    (comp.compilers)