4

Why we can select events in VB.NET Editor From Top Combo-boxes , But We cannot select the Events For Our C# Project like that.

I Know we can use the Events List in Properties window , But Isn't a way to do it like VB.NET?

For Example in asp.net project , there a events listed for any control we select , can we do something like that for C# ?

In VB.NET We can select and see the events from editor. but in C# we can't . is it true? or there is way to do that?

Here is the image in VB.NET , C# can done it ?

enter image description here

S.A.Parkhid
  • 2,772
  • 6
  • 28
  • 58
  • 1
    Do you mean filtering only events in the intellisense? I don't believe the C# editor supports this (unfortunately). The other ways of choosing events (in the dropdown in the upper-right; in the properties window under "events") are exactly the same in both languages though. Or are you talking about something else? – BlueRaja - Danny Pflughoeft Oct 23 '11 at 21:41
  • If you have worked with vb.net , you have noticed that we can select our events directly form our code editor , can we do something like that in c# code editor ? – S.A.Parkhid Oct 23 '11 at 21:43
  • I didn't work with vb.net but you can choose your event from intellisense or in UI what's wrong with this ways, why do you need other options, assume there is another option which is not in c# what's the benefit you loose? – Saeed Amiri Oct 23 '11 at 21:46
  • mr.amiri my problem is in speed and ASP.NET have many events , this causes me many problems for my asp.net app. – S.A.Parkhid Oct 23 '11 at 21:57
  • 1
    The behavior of the Navigation Bar is different in C# and VB, you cant do nothing about it. [Here is a similar question](http://stackoverflow.com/questions/5053186/visual-studio-2010-showing-available-events-from-code-behind) – Alon Adler Oct 23 '11 at 22:09
  • Resharper helps out with this and provides better intellisense and code snippets when writing C#. – Jeremy Oct 24 '11 at 00:13

1 Answers1

0

This is sorta a restatement of minitech's answer, but....

VB.Net and C# have different approaches to events, and this is reflected in the IDE. C# essentially treats them like any other delegate, while VB gives them special treatment in order to make them easier to use (declarative approach to adding them, and as you point out showing them in the form editors menubar).

There is no technical reason why they couldn't be shown in the VS when using C#, but not doing so is consistent with the C# approach to events.

jmoreno
  • 12,752
  • 4
  • 60
  • 91