控制台输入?Console.ReadLine using System;public class Example { public static void Main() { string line; Console.WriteLine("Enter one or more lines of text (press CTRL+Z to exit):"); Console.WriteLine(); do { Console.Write(" "); line = Console.ReadLine(); if (line != null) Console.WriteLine(" " + line); //这里存到数组中 } while (line != null); } } 来自msdn: http://msdn.microsoft.com/en-us/library/system.console.readline.aspx
using System;public class Example
{
public static void Main()
{
string line;
Console.WriteLine("Enter one or more lines of text (press CTRL+Z to exit):");
Console.WriteLine();
do {
Console.Write(" ");
line = Console.ReadLine();
if (line != null)
Console.WriteLine(" " + line); //这里存到数组中
} while (line != null);
}
}
来自msdn:
http://msdn.microsoft.com/en-us/library/system.console.readline.aspx
char[] chrRec;
chrRec = strRec.ToCharArray();
strList.add("123123");
strList.ToArray();
{
int[] items = new int[10];
//Random random = new Random();
Console.WriteLine("请输入数组值:");
for (int i = 0; i < items.Length;i++ )
{
items[i] = Convert.ToInt32(Console.ReadLine());//手动输入10个整数
}
}
string s="abcdef";
List<String> strList=new List<String>();
strList.add(s)
//导入string数组
string[] strs=new string[strList.length]();
for (int i=0;i<strList.length;i++)
{
strs[i]=strList[i];
}