Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 761.2k

Difference on calling class within a function and Public

Oct 21 2013 1:49 AM
Sir, I need your help in the following topic:-

I here writing two methods of calling a class. Please give a explanation that which is better ,faster performable and more standard

Also tell me which method reduce size of the program?




1.Method 1:

namespace Employer
{
    public partial class frmRejectionIn : Form
    {
        public frmRejectionIn()
        {
            InitializeComponent();
        }

     EmployeeSP SPEmployee=new EmployeeSP();// call class for entire form
}
 

2. Method 2:

private void btnSave_Click(object sender, EventArgs e)
{

EmployeeSP SPEmployee=new EmployeeSP(); // call class within the function

}

private void btnDelete_Click(object sender, EventArgs e)
{

EmployeeSP SPEmployee=new EmployeeSP(); //  again called the class within the function

}


Answers (3)