Difference on calling class within a function and Public
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
}