Tuesday, October 25, 2011

List Declaration in Different Types

List Declaration


List<Locations> ObjLoc = Obj;

            GridView1.DataSource = (from L in ObjLoc select L);
      GridView1.DataBind();


List<Locations> Obj
        {
            get
            {
                List<Locations> ObjLoc = new List<Locations>{
                new Locations { Id=1, Name="A", Age=21,Phone=021},
                new Locations { Id=2, Name="B", Age=22,Phone=022},
                new Locations { Id=3, Name="C", Age=23,Phone=023},
                new Locations { Id=4, Name="D", Age=24,Phone=024},
                new Locations { Id=5, Name="E", Age=25,Phone=025},
                new Locations { Id=6, Name="F", Age=26,Phone=026},
                new Locations { Id=7, Name="G", Age=27,Phone=027},
                new Locations { Id=8, Name="H", Age=28,Phone=028},
                new Locations { Id=9, Name="I", Age=29,Phone=029},
                new Locations { Id=10, Name="J", Age=30,Phone=030},
                new Locations { Id=11, Name="K", Age=31,Phone=031},
                new Locations { Id=12, Name="L", Age=32,Phone=032},
                new Locations { Id=13, Name="M", Age=33,Phone=033},
                new Locations { Id=14, Name="M", Age=34,Phone=034}
            };
                return ObjLoc;
            }
        }

No comments:

Post a Comment