Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 来自文本框的.NET fill StreamReader_C#_String_Stream - Fatal编程技术网

C# 来自文本框的.NET fill StreamReader

C# 来自文本框的.NET fill StreamReader,c#,string,stream,C#,String,Stream,我想在streamReader中解析用户输入。我的代码是: string txt = txtin.text ; //<~~ txtin is something like root:x:1:1.... using (TextReader reader = new TextReader( txt)) { string line = ""; while ((line = reader.ReadLine()) != null) { string use

我想在streamReader中解析用户输入。我的代码是:

string  txt = txtin.text ; //<~~ txtin is something like root:x:1:1....

using (TextReader reader = new TextReader( txt))
{
    string line = "";
    while ((line = reader.ReadLine()) != null)
    {
        string userName = line.Substring(0, line.IndexOf(':'));
    }
}
string txt=txtin.text// 使用。是一个抽象类。您不能创建它的实例

using (TextReader reader = new StringReader(txt))
{
  //...
}
使用。是一个抽象类。您不能创建它的实例

using (TextReader reader = new StringReader(txt))
{
  //...
}