为什么我无法在控制台应用程序下将System.IO添加到引用中 [英] Why I can't add System.IO into reference under Console application
本文介绍了为什么我无法在控制台应用程序下将System.IO添加到引用中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是一名新的C#播放器。
我尝试创建非常简单的控制台应用程序,可以帮助我在引用中添加字符串。
但我发现我找不到System.IO来添加参考。结果我可以在程序中说Using System.IO,结果我不能使用streamwriter类。
有谁能帮我弄清楚出了什么问题?
Hi, I am a new C# player.
I try to create very easy console application that can help me add strings inside reference.
But I found I couldn't find System.IO to add to reference. As a result I can say "Using System.IO" in program, as a result I can't use streamwriter class.
Can anyone help me to figure out what is wrong?
推荐答案
StreamWriter是MSCORLIB的一部分.DLL程序集,应该已经为你引用了System.Core: https://msdn.microsoft.com/en-us/library/system.io.streamwriter(v = vs.110).aspx [ ^ ]
因此,如果您的应用程序是一个完整的Windows应用程序(某些移动框架更加有限),StreamWriter应该可用。
当然,我可以在我的控制台应用程序中使用StreamWriter。
所以 - 首先检查案例:StreamWriter与Streamwriter不同或者编程,只有第一个才能工作。
如果可以的话:
StreamWriter is part of the MSCORLIB.DLL assembly, which should be already referenced for you unsed "System.Core": https://msdn.microsoft.com/en-us/library/system.io.streamwriter(v=vs.110).aspx[^]
As a result, StreamWriter should be available, provided your app is a "full" Windows app (some of the mobile frameworks are rather more limited).
Certainly, I can use StreamWriter in my console apps.
So - start by checking the case: StreamWriter is not the same as Streamwriter or streamwriter and only the first will work.
If that's ok:
StreamWriter sw = new StreamWriter(path);
检查您的项目属性,并确保您没有使用其中一个可能不包含它的有限框架。
Check your project properties and make sure you aren't using one of the "Limited" frameworks which may not contain it.
这篇关于为什么我无法在控制台应用程序下将System.IO添加到引用中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文