1
我想解析streamReader中的用戶輸入。我的代碼是:.NET從文本框中填充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(':'));
}
}
我得到這個錯誤:
Cannot create an instance of the abstract class or interface 'System.IO.TextReader'