Custom Collection Parameter in a Web Service

This post below will show you how to pass a custom collection as a parameter to the webservice.
Create a custom collection class...
public class Person
{
public int Age;
public string FName, LName;
public Person() { }
 
public Person(string fname, string lname, int age)
{
Age = age;
FName = fname;
LName = lname;
}
}
 
Create a Web Method...
 
[WebMethod]
public void Method(Person[] fields, bool attachmentincluded)
{
           System.Collections.Generic.List<Person> people = new List<Person>(fields);
            foreach (Person i in people)
            {
                string F, L;
                int A;
                F =i.FName;
                L = i.LName;
                A = i.Age;
            }
 }
 
In the consumer application...
 
     //Create People...
     localhost.Person john = new localhost.Person();
     john.FName = "John";
     john.LName = "Doe";
     john.Age = 37;
    
     localhost.Person jane = new localhost.Person();
     jane.FName = "Jane";
     jane.LName = "Doe";
     jane.Age = 37;
    
     //Create array
     localhost.Person[] people = { john, jane };
 
     //Call Web Service
     localhost.Service1 s = new localhost.Service1();
     s.Method(people, false);