I’m brand new to C#, but I think I have the correct “using” statements here, so I presume the problem is somewhere in my class structure or syntax? I’m getting the “The type or namespace name ‘Textreader’ could not be found” error. Thank you.
using System;
using System.IO;
namespace Layouts.Test_control {
public partial class Test_controlSublayout : System.Web.UI.UserControl
{
private void Page_Load(object sender, EventArgs e) {
Textreader tr = new StreamReader("date.txt");
Console.WriteLine(tr.ReadLine());
tr.Close();
}
}
}
C# is case sensitive so you probably want this instead:
Apart from that you’ve mentioned in your question that you would use the correct “using” statements, but obviously you’re not disposing/closing the
StreamReaderat all. You’re also reading only one line of the file.