Creato da Arudy il 15/09/2006
Note, appunti, di tutto un pò riguardo alla mia esperienza di programmatore

Tag

 

Archivio messaggi

 
 << Ottobre 2024 >> 
 
LuMaMeGiVeSaDo
 
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
 
 

Cerca in questo Blog

  Trova
 

FACEBOOK

 
 

Area personale

 
 
RSS (Really simple syndication) Feed Atom
 

 

« Comprimere e decomprimer...Clonare una DataRow »

Risparmiare risorse per gli eventi ASP.NET

Post n°4 pubblicato il 15 Settembre 2006 da Arudy
 

Ecco come risparmiare un pò di risorse quando si scrive un evento in ASP.NET


private static readonly object EventSubmitKey = new object();


// The Submit event.
[
Category("Action"),
Description("Raised when the user clicks the button."),
EditorBrowsable(EditorBrowsableState.Always),
Browsable(true)
]


public event EventHandler Submit
{
   add
   {
      Events
.AddHandler(EventSubmitKey, value);
   }


   remove
   {
      Events
.RemoveHandler(EventSubmitKey, value);
   }
}


// The method that raises the Submit event.
protected virtual void OnSubmit(EventArgs e)
{
   EventHandler SubmitHandler = (EventHandler)Events[EventSubmitKey];


   if (SubmitHandler != null)
   {
      SubmitHandler(
this, e);
   }
}

 
Condividi e segnala Condividi e segnala - permalink - Segnala abuso
 
 
Vai alla Home Page del blog
 

© Italiaonline S.p.A. 2024Direzione e coordinamento di Libero Acquisition S.á r.l.P. IVA 03970540963