C# : more efficiency coding in delegate/event subscribe in Visual Studio 2010 -


When I subscribe to the event, I am coding like this: (in Visual Studio 2010)

1. I will write as the following code:
  this.Loaded + =   

2. I press the tab key

3 An IDE Automatically fill the code given below:
  this.Loaded + = New routing document handler (someClass_Loaded);   

4 But the method did not exist in some classes yet. So I will write a method like the following code:
  Private zero someClass_Loaded () {}   

5 But some class markings are not properly defined yet happened. So I have set the cursor on the delegate, "RoutedEventHandler".

6 I press F12 and then IDE is showing me a defining routing and handler.
  Namespace system. Windows {[...] Public Representative Zero Routing Avent Handler (Object Sender, Routing Avenger, ARGS E); }   

7. Copy the RoutedEventHandler logic.

8 I paste it in some class_logged method
  Private zeroes class = loaded (object sender, routing and search engine) {}   < P> Is this the best coding practice?  

ps When I subscribe to an event by an unknown method, then I do this.

  1. Press Tab key.

    Try to do this twice, not only will Visual Studio expand new event handler assignments, it will also create a stub method in that class with the correct name and proper signature. .

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -