草庐IT

symfony-console

全部标签

c# - (Console.BufferHeight) 我无法使用 Console.WriteLine 看到/滚动查看所有控制台输出

当我运行这段代码时,输​​出窗口顶部的数字是99701。为什么我一直看不到1?我实际上看到所有数字都在输出,但在控制台窗口上,我只能滚动到足以看到99701的高度(我猜)。我在VistaHome上使用VisualC#express。:DusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Text.RegularExpressions;usingutilities;namespaceTesting_Project{classProgram{staticvoidM

c# - 为什么 Console.Readline() 对其允许的文本长度有限制?

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:Console.Readline()maxlength?在myattempt找到一个非常简单的文本到语音应用程序Idecideditwasfastertowritemyown.然而,我注意到Console.Readline()每行允许的文本数量限制为254个字符;我在方法文档中找不到有关此限制的任何信息。这是Windows堆栈的限制,还是我的代码有问题?我怎样才能克服它?我可以决定用Console.Readkey()逐个字符地阅读,但我不会因为MSDOS的愚蠢文本粘贴行为而冒丢失字符的风险吗?

c# - Release模式下 Console.SetOut 的问题?

我的代码中有一堆Console.WriteLines,我可以在运行时观察它们。我与我也编写的native库进行通信。我想在native库中添加一些printf并观察它们。但是我在运行时看不到它们。我创建了一个复杂的helloworld应用程序来演示我的问题。当应用程序运行时,我可以调试到native库并看到调用了helloworld。但是,输出永远不会出现在文本编写器中。请注意,如果相同的代码作为控制台应用程序运行,则一切正常。C#:[DllImport("native.dll")]staticexternvoidTest();StreamWriterwriter;publicForm

c# - 设计一个F#模块被C#调用(Console/MVC/WPF)

我一直在尝试使用DeedleF#Library编写F#批处理程序。它工作得很好。但是,我不确定以下2个任务的最佳设计:将F#模块合并到现有的ASP.netMVC/WebApi系统中创建一个WPF界面作为各种F#模块的控制面板和视觉依赖Controller。F#模块执行的任务类型是处理时间序列和应用统计过程来导出新的时间序列。我一直在尝试为现有模块创建一个类包装器,以便可以从C#代码中调用它。我从C#DeepDive读到这是向C#调用者公开F#模块的更好方法。以下是示例包装器:typeTimeSeriesDataProcessor(fileName:string)=letmutable_

c# - Console/Win 服务应用程序不需要 ConfigureAwait(false),对吗?

我使用async/await有一段时间了,但最近深入研究,并阅读了很多最佳实践提示,默认总是使用ConfigureAwait(false)防止死锁,提高性能。我只是想确保我没有遗漏任何东西,因为我认为这仅适用于实际当前SynchronizationContext或TaskScheduler正在运行的情况,对吗?如果我有一个正在响应消息/命令/等的Windows服务应用程序。异步地,它总是只使用默认的调度程序=可能等待完成的线程池线程将执行延续,因此没有死锁,使用ConfigureAwait(false)也不会产生性能差异,正确?不是我不能把它放在那里,而是我非常讨厌嘈杂的代码.....

c# - Console.ReadKey 与带有计时器的 Console.ReadLine

以下代码是一个众所周知的示例,用于显示调试版本和发布版本之间的区别:usingSystem;usingSystem.Threading;publicstaticclassProgram{publicstaticvoidMain(){Timert=newTimer(TimerCallback,null,0,2000);Console.ReadLine();}privatestaticvoidTimerCallback(Objecto){Console.WriteLine("InTimerCallback:"+DateTime.Now);GC.Collect();}}如果您使用调试配置运行

c# - Debug.WriteLine() 与 Console.WriteLine() 处理文化的方式不同。为什么?

考虑以下控制台应用程序代码:Thread.CurrentThread.CurrentCulture=newCultureInfo("en-GB");Thread.CurrentThread.CurrentUICulture=Thread.CurrentThread.CurrentCulture;DateTimedate=newDateTime(2014,01,19);Console.WriteLine("{0}",date);//Prints19/01/2014Debug.WriteLine("{0}",date);//Prints01/19/2014Debug.WriteLine(d

c# - 为 Console.Write 添加前缀的推荐方法是什么?

我正在寻找一种向每个Console.Write[Line]插入前缀(日期和时间)的方法。我正在寻找一种推荐的方法,就像更改输出的推荐方法是使用Console.SetOut.我很清楚我可以执行String.Format("{0}{1}",DateTime.Now,msg),但我试图将其作为最后的手段。问题是输出在运行时是可变的,默认的已经附加了当前时间。如果我将它附加到我的代码中,我将复制日期。有这样的事吗?我正在使用Monotouch,所以我只能使用为其编译的库。 最佳答案 您需要inherit从System.IO.TextWrit

c# - 在循环外添加一个 Console.WriteLine() 会改变循环的计时 - 为什么?

考虑以下代码:usingSystem;usingSystem.Diagnostics;namespaceDemo{classProgram{staticvoidMain(string[]args){Stopwatchsw=newStopwatch();for(inttrial=0;trial当我使用VisualStudio2010在Windows7x64上编译并运行此版本的RELEASEx86版本时,我得到以下计时(在IntelCorei7上运行)loop1()took00:00:01.7935267loop2()took00:00:01.4747297loop3()took00:00

c# - c# 中的 stdout 与 console.write

我是C#/编程的新手,作为一项学习练习,我完成了将文本更改为小写的在线挑战。挑战指定它必须“打印到标准输出”,但我使用Console.Writeline完成了挑战usingSystem;usingSystem.Collections.Generic;usingSystem.IO;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespaceLowercase{classProgram{staticvoidMain(string[]args){using(StreamReaderreader=newStrea