Answers for "how to read line array in c#"

C#
1

c# how to write an array in a single line

// How to display an array on the same line:
string[] names = {"name1", "name2", "name3"}
Console.WriteLine("{0}", string.Join(", ", names));
Posted by: Guest on October-28-2020
1

c# string console readline array

string foo = Console.ReadLine();
string[] tokens = foo.Split(",");
List<int> nums = new List<int>();
int oneNum;
foreach(string s in tokens)
{
    if(Int32.TryParse(s, out oneNum))
        nums.Add(oneNum);
}
Posted by: Guest on December-08-2021

C# Answers by Framework

Browse Popular Code Answers by Language