Answers for "c# list add by object"

C#
10

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 });
Posted by: Guest on April-27-2020
12

c# adding to a list

//Declaring that its a list
List<string> test = new List<string>(); 
test.Add("Hello")
Posted by: Guest on March-02-2020
-1

how to add to a list in c#

List<string> names = new List<string>();
names.Add("Bob");
Posted by: Guest on February-08-2022

C# Answers by Framework

Browse Popular Code Answers by Language