1
Je veux analyser l'entrée utilisateur dans un lecteur de flux. Mon code est:.NET remplissage StreamReader à partir de la zone de texte
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(':'));
}
}
Je reçois cette erreur:
Cannot create an instance of the abstract class or interface 'System.IO.TextReader'