我需要提供一个解决方案来查找字符串数组中的最短字符串.我当时认为应该比较每个字符串的长度才能返回.
这是我被困的地方
static void Main(string[] args)
{
//find the shortest string in an array of string
string[] names = new string[3]{
"Tom", "and", "jerry"
};
foreach(string name in names){
Console.Write(name + ", ");
}
Console.ReadKey();
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我比较部分并解释它