Showing posts with label Nested List in C#. Show all posts
Showing posts with label Nested List in C#. Show all posts

12 August 2013

Nested List in C#

Nested List in C#

Consider there are two Class

 public class Person
    {
        public int Id { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }

        public List< Addresses > { get; set; }

    }

    public class Address
    {
        public string Line1 { get; set; }
        public string Line2 { get; set; }
        public string ZipCode { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string Country { get; set; }
    }

Procedure used to add multiple class in the List
var personDetails = new List< Person >
                              {
                                  new Person
                                  {
                                      Id = 1, FirstName = "Arun",
                                      LastName = "Prakash",
                                      Addresses = new List< Address >
                                                      {
                                                          new Address{Line1 = "Hope College",Line2 = "Coimbatore"}
                                                 
                                                      }
                                  },
                                                                                                     
                                  new Person{
                                      Id = 2, FirstName = "Sanjay",
                                      LastName = "Ramasamy",
                                      Addresses = new List< Address >
                                                      {
                                                          new Address{Line1 = "Anna Salai",Line2= "Chennai"}
                                                     
                                                      }
                                  }
                              };

Consistency level in Azure cosmos db

 Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...