static string[] myFriends = new string[] {"Robert","Andrew","Leona","Ashley"};
如何从这个静态字符串数组中提取名称,以便可以在不同的行上单独使用它们?如:
罗伯特坐在 1 号椅子上
安德鲁坐在椅子上 2
Leona 坐在 3 号椅子上
Ashley 坐在 4 号椅子上
我猜我必须将它们分配给值,然后在 a 中WriteLine
Command
,我会为每个相应的名称输入 {1}、{2}、{3} 等?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Friends
{
class Program
{
public void count(int inVal)
{
if (inVal == 0)
return;
count(inVal - 1);
Console.WriteLine("is sitting in chair {0}", inVal);
}
static void Main()
{
Program pr = new Program();
pr.count(4);
}
static string[] myStudents = new string[] {"Robert","Andrew","Leona","Ashley"};
}
}
我想将名称添加到“坐在椅子上”行。