Answers for "c# how to add list of string while declaring"

C#
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

c# add list to list

using System;
using System.Collections.Generic;

namespace add_list
{
        static void Main(string[] args)
        {
            List<string> first = new List<string> { "do", "rey", "me" };
            List<string> second = new List<string> { "fa", "so", "la", "te" };
            first.AddRange(second);
            foreach(var e in first)
            {
                Console.WriteLine(e);

            }
        }
    }
}
Posted by: Guest on February-03-2022

C# Answers by Framework

Browse Popular Code Answers by Language