Sanjay Sharma

Sanjay Sharma

  • 1.3k
  • 413
  • 27.3k

Object Initialization in ASP.Net webForm

May 26 2018 7:23 AM
Hi Team,
 
I am working on ASP.Net WebForm ( in Era of MVC sad ).
 
I have following button events which perfrom independent actions 
 
XX.ProductBLL.GeneralInfo generalInfoBLL = new XX.ProductBLL.GeneralInfo generalInfoBLL();
 
protected void btnSaveCharge_Click(object sender, EventArgs e)
{
  generalInfoBLL.CallmethodA();
  .......
   ....... 
 
protected void btnAddCharge_Click(object sender, EventArgs e)
{
  
generalInfoBLL.CallmethodB();
.......
.......
 
.......
.......
 
}
 
Question is this fesible way  to avoid initaization in each event? will not anytime 
 generalInfoBLL to null in anyof the event.
 

Answers (1)