How to create a list of int values in C#

1 Answer

0 votes
using System;
using System.Collections.Generic;

class Program
{
    static void Main() {
        List<int> int_list = new List<int>(new int[] { 1, 2, 3, 4, 5,6 ,7 } );

        Console.WriteLine(string.Join(',', int_list));
    }
}




/*
run:

1,2,3,4,5,6,7

*/

 



answered Feb 11, 2024 by avibootz
edited Feb 12, 2024 by avibootz

Related questions

1 answer 194 views
2 answers 197 views
1 answer 1,423 views
1 answer 150 views
1 answer 172 views
1 answer 214 views
1 answer 151 views
...