create new list of object and add value in c# code example

Example 1: add object to list c#

List<Author> authors = new List<Author>  
{  
    new Author { Name = "Mahesh Chand", Book = "ADO.NET Programming", Price = 49.95 },  
    new Author { Name = "Neel Beniwal", Book = "Jump Ball", Price = 19.95 },  
    new Author { Name = "Chris Love", Book = "Practical PWA", Price = 29.95 }  
};  
// Add more items to the list  
authors.Add(new Author { Name = "Mahesh Chand", Book = "Graphics with GDI+", Price = 49.95 });  
authors.Add(new Author { Name = "Mahesh Chand", Book = "Mastering C#", Price = 54.95 });  
authors.Add(new Author { Name = "Mahesh Chand", Book = "Jumpstart Blockchain", Price = 44.95 });

Example 2: c# add list to list

List<string> initialList = new List<string>();
// Put whatever you want in the initial list
List<string> listToAdd = new List<string>();
// Put whatever you want in the second list
initialList.AddRange(listToAdd);