2
Answers

Collection Initialization (How to pass values)

Mahesh Babu

Mahesh Babu

13y
2k
1
By using class object we can pass values like this.

Under UI Layer
clsRegistraction register=new ClsRegistration();
string FirstName=txtFirstName.Text;
string LastName=txtLastName.Text;
string Address=txtAddress.Text;
register.InsertDetails(FirstName,LastName,Address);

Now I have one method in ClsRegistration class i.e InsertDetails()

so I can pass values like this.


Under BAL
   Public void InsertDetails(string FirstName,string LastName,string   Address)
{
      ------some code----
}


---------------------------------------------------------------------------



Now I am using List.

List<clsRegistration> register = new List<clsRegistration>();
{
new clsRegistration { FirstName=txtFirstName.Text, LastName= txtLastName.Text,Address=txtAddress.Text};
}

Now how to pass these list values that InsertDetails()  like above procedure

Should I create class object and call the method ? 
is it compalsary? 







Answers (2)