C# Print list of string array

后端 未结 5 2087
说谎
说谎 2021-01-02 01:02

I\'m very new to c# and have a question, how do I print list of string arrays? I can do it from string[] using Console.WriteLine, but if I do that for list with forEach it j

5条回答
  •  盖世英雄少女心
    2021-01-02 01:45

    string[] arr = new string[2]{"foo","zoo"}; // sample Initialize.
    
    // Loop over strings.
    foreach (string s in arr)
    {
        Console.WriteLine(s);
    }
    

    The console output:

    foo
    zoo
    

提交回复
热议问题