console.writeline

Console.Writeline working on x86 but not x64

 ̄綄美尐妖づ 提交于 2019-12-07 00:48:34
问题 I'm testing a project in visual studio 2012. When I run my code in x86, Console.Writeline shows up in the output window. However, when I run it in x64, it does not. I understand I can use System.Diagnostics.Debug instead, but I would really like to understand why Console.Writeline is not working, or if there is a setting somewhere. Thanks. Edit: An observation: The Visual Studio hosting process is disabled for both builds. When I enable it, all Console.Writeline messages show up for both x64

Adding headers into CSV output file using StreamWriter

断了今生、忘了曾经 提交于 2019-12-06 16:17:38
I am trying to add headers into the CSV file and as a headers I would like to have the variables names used in the WriteLine . Here you have my code: using (StreamWriter file = new StreamWriter(fs)) { for (int s = 0; s < pr.Length; ++s) { string[] UsersIDS = new string[] {""}; UsersIDS = db.GetUsersList(pr[s].ProjectID); file.WriteLine( pr[s].ProjectID + '"' + ',' + '"' + pr[s].ProjectTitle + '"' + ',' + pr[s].PublishStatus + '"' + ',' + UsersIDS.Length); } } I propose you following modification using (StreamWriter file = new StreamWriter(fs)) { file.WriteLine("ProjectID, ProjectTitle

What does {0} stands for in Console.WriteLine?

北慕城南 提交于 2019-12-06 14:47:08
Given the code : // person.cs using System; // #if false class Person { private string myName = "N/A"; private int myAge = 0; // Declare a Name property of type string: public string Name { get { return myName; } set { myName = value; } } // Declare an Age property of type int: public int Age { get { return myAge; } set { myAge = value; } } public override string ToString() { return "Name = " + Name + ", Age = " + Age; } public static void Main() { Console.WriteLine("Simple Properties"); // Create a new Person object: Person person = new Person(); // Print out the name and the age associated

How to read sql generated by NHibernate in Visual Studio

不问归期 提交于 2019-12-06 05:29:59
According to what I know, there are 3 ways to read the sql script generated by NHibernate: 1. log4net 2. sql profiler 3. show_sql = true Here I just want to talk about 3rd one for it's said that I can read the sql in the output window in Visual Studio. But whatever I do, I can see nothing?! Becasue some guy said the "show_sql = true" just means "Console.WriteLine()", so I post a question here . I have to say I don't get what I want, so here I summarize my questions: in the output window in an web application: Can the result of "Console.WriteLine()" be shown? Can "show_sql=true" make the sql

Interpreting dates: Console.Writeline vs. string.Format

為{幸葍}努か 提交于 2019-12-05 07:24:19
Given the following C# code: var dt = DateTime.Now; Console.WriteLine("{0:MM/dd/yy} ... {1}", dt, string.Format("{0:MM/dd/yy}", dt)); ... when the short date (under Windows 7, Control Panel -> Region and Language -> Additonal Settings -> Date ) is set to the USA standard of " M/d/yyyy ," I get this: 06/17/14 ... 06/17/14 However, when I change the short date to " ddd dd MMM yyyy ," I get this: 06/17/14 ... 06 17 14 I was under the impression that Console.WriteLine and string.Format always string formatted DateTime values identically. What is the explanation for this discrepancy? EDIT: Looks

Console.Writeline working on x86 but not x64

这一生的挚爱 提交于 2019-12-05 04:48:43
I'm testing a project in visual studio 2012. When I run my code in x86, Console.Writeline shows up in the output window. However, when I run it in x64, it does not. I understand I can use System.Diagnostics.Debug instead, but I would really like to understand why Console.Writeline is not working, or if there is a setting somewhere. Thanks. Edit: An observation: The Visual Studio hosting process is disabled for both builds. When I enable it, all Console.Writeline messages show up for both x64 and x86. When I disable it again, only the x86 displays Console.Writeline . There should be no

Calling Console.WriteLine before allocating the console

元气小坏坏 提交于 2019-12-04 01:20:33
问题 I've recently encountered the following problem with my application: it didn't show any console output, though the console had been allocated by using AllocConsole . I managed to figure out soon that it was caused by an attempt (hidden deeply in code) to write to the console before the AllocConsole was called. So it looked like this: Console.WriteLine("Foo"); // no console allocated yet AllocConsole(); // console window appears Console.WriteLine("Bar"); // expecting "Bar" in the console, but

Why does Console.WriteLine() function miss some characters within a string?

爷,独闯天下 提交于 2019-12-03 09:43:24
I have a string, declared as: string text = "THIS IS LINE ONE "+(Char)(13)+" this is line 2"; And yet, When I write Console.WriteLine(text); , the output is: this is line 2E Why is this behaviour happening? Or is it because I'm being stupid and missing something obvious? Why does it not print: THIS IS LINE ONE [CR] //where the CR is a non printed character this is line 2 EDIT Please note: this is NOT a 'how do I add a carriage return' question. (char)13 is a carriage return (To the left margin on the current line) THIS IS LINE ONE \r this is line 2" Is interpreted as: Print THIS IS LINE ONE

Where does Console.WriteLine go in ASP.net production environment?

こ雲淡風輕ζ 提交于 2019-12-01 06:15:47
Is there any chance that I can see the output of Console.WriteLine command after deploying my asp.net web application in IIS? (no more Visual Studio) I checked this question: Where does Console.WriteLine go in ASP.NET? But the problem is that they all talk about debugging/development environment which output window of Visual Studio can be used to check the output of those lines. Is there really a way to view the output of those lines without installing extra logging tools (e.g. log4net)? akton Console.WriteLine (which redirects to Console.Out.WrlteLine by default) is written to Stream.Null ,

Where does Console.WriteLine go in ASP.net production environment?

痞子三分冷 提交于 2019-12-01 03:48:25
问题 Is there any chance that I can see the output of Console.WriteLine command after deploying my asp.net web application in IIS? (no more Visual Studio) I checked this question: Where does Console.WriteLine go in ASP.NET? But the problem is that they all talk about debugging/development environment which output window of Visual Studio can be used to check the output of those lines. Is there really a way to view the output of those lines without installing extra logging tools (e.g. log4net)? 回答1: