G
Guest
Hello All,
Can someone please answer my question on how the following objects would be
instantiated?
- - - - - - - - - - - -
public class CustomPaging
{
private int _PageSize = 10; // Default page size
secure.WebServices.General objGeneral = new secure.WebServices.General();
private DataSet _DataSet = new DataSet();
private DataTable _DataTable = new DataTable();
public CustomPaging()
{
//
// TODO: Add constructor logic here
//
}
........
method1()
{ }
method2()
{}
} // end of class
- - - - - - - - - -- - - - - - -
In the above piece of code, I am instantiating few variables and objects
just after public class CustomPaging. My question is if suppose I create an
object of this class and call method1 followed by method2....how many times
would the objects be created?
I know that had I kept the initialization code in the constructor, they
would be initialized only once, i.e., when the object is created. But how
about in this case where they are not initialized in the constructor?
Can someone please answer my question on how the following objects would be
instantiated?
- - - - - - - - - - - -
public class CustomPaging
{
private int _PageSize = 10; // Default page size
secure.WebServices.General objGeneral = new secure.WebServices.General();
private DataSet _DataSet = new DataSet();
private DataTable _DataTable = new DataTable();
public CustomPaging()
{
//
// TODO: Add constructor logic here
//
}
........
method1()
{ }
method2()
{}
} // end of class
- - - - - - - - - -- - - - - - -
In the above piece of code, I am instantiating few variables and objects
just after public class CustomPaging. My question is if suppose I create an
object of this class and call method1 followed by method2....how many times
would the objects be created?
I know that had I kept the initialization code in the constructor, they
would be initialized only once, i.e., when the object is created. But how
about in this case where they are not initialized in the constructor?