English 中文(简体)
C 精简 “无法找到空间名称的类型或名称”错误,但我转而使用该系统。 IO namespace
原标题:C# Streamreader "The type or namespace name could not be found" error, but I ve got the System.IO namespace

I m 贴上C#的新品牌,但我认为我这里有正确的“使用”声明,因此,我假定问题在我的班级结构或同堂结构中有些地方? I m 读到“不能发现哪类或名称的校正”错误。 谢谢。

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#是一种对案件敏感的语言。 你的“透镜”目标被错了。 它应为“TextReader

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();
    }
  }
}




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...