console.writeline

question about print List<T> to screen

人走茶凉 提交于 2021-02-10 14:21:05
问题 A question about List; When i have "List<PlugwiseMessage> msg" with the value's from the picture : I only get PlugwiseLib.BLL.BC.PlugwiseMessage as output. But how can i see the value's from _message, _owner and _type on my screen ? or the value's of Message, Owner, and Type ? And can somebody explain the difference to me ? 回答1: Your list has a collection of PlugwiseLib.BLL.BC.PlugwiseMessage objects. Message, Owner and Type are properties on the object. The _message, _owner and _type

question about print List<T> to screen

荒凉一梦 提交于 2021-02-10 14:21:01
问题 A question about List; When i have "List<PlugwiseMessage> msg" with the value's from the picture : I only get PlugwiseLib.BLL.BC.PlugwiseMessage as output. But how can i see the value's from _message, _owner and _type on my screen ? or the value's of Message, Owner, and Type ? And can somebody explain the difference to me ? 回答1: Your list has a collection of PlugwiseLib.BLL.BC.PlugwiseMessage objects. Message, Owner and Type are properties on the object. The _message, _owner and _type

Console.writeline using strings

99封情书 提交于 2021-02-07 08:48:19
问题 A simple question: How do you display strings in the CMD using Console.Writeline() using C# in VS? I Know you use + for ints and floats. But what do you use for strings? This is what i have: private string productName; public void GetItemData() { ShowReciept(); } private void ReadItem() { Console.WriteLine("Enter the product's name: "); productName = Console.ReadLine(); } private void ShowReciept() { Console.WriteLine("**** Name of product:", productName); } In void ShowReciept() it writes

Console.writeline using strings

社会主义新天地 提交于 2021-02-07 08:46:11
问题 A simple question: How do you display strings in the CMD using Console.Writeline() using C# in VS? I Know you use + for ints and floats. But what do you use for strings? This is what i have: private string productName; public void GetItemData() { ShowReciept(); } private void ReadItem() { Console.WriteLine("Enter the product's name: "); productName = Console.ReadLine(); } private void ShowReciept() { Console.WriteLine("**** Name of product:", productName); } In void ShowReciept() it writes

Interpreting dates: Console.Writeline vs. string.Format

守給你的承諾、 提交于 2020-01-13 09:49:05
问题 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

Infrequent hangs in a multi-threaded C# console application when using Console.Writeline() or Console.Write()

一世执手 提交于 2020-01-03 08:15:27
问题 I have written a console application that makes use of console.write and console.writeline to provide some logging. The application is a server application that uses asynchronous beginacceptconnection() and beginread() ( Sockets ) for communication. Occasionally i get reports of it hanging and from the limited debug i can do i am able to see the problem being Console.Writeline() or Console.write(). Being multi-threaded I have been careful to have a lock around the logging class so only one

Is there a way to delete a character that has just been written using Console.WriteLine?

拜拜、爱过 提交于 2019-12-28 08:07:40
问题 Is there any way to delete the last character from the console, i.e. Console.WriteLine("List: apple,pear,"); // Somehow delete the last ',' character from the console. Console.WriteLine("."); // Now the console contains "List: apple,pear." Sure, I could create a string first then print that to the console, but I'm just curious to see if I can delete characters directly from the console. 回答1: "\b" is ASCII backspace. Print it to back up one char. Console.Write("Abc"); Console.Write("\b");

Writing to console in c#: can you single writeline with multiple colors, or lock the console to do multiple writes?

那年仲夏 提交于 2019-12-24 15:42:20
问题 I want to put a string with more than one color onto the console and have it perform as if it were a single WriteLine, as opposed to multiple writes which could get interrupted, or corrupted by other threads writing at the same time. So the post below looked like it was going in the right direction, but I do not control all the code that is writing to the console. My code is restricted to the dll that I am authoring, so I can't just go putting locks everywhere that could interfere. If it were

C# Can the Console overflow with too many Writelines?

懵懂的女人 提交于 2019-12-23 08:03:18
问题 If I have a program that performs Console.Writeline multiple times per second, and the program is left running for a long period of time, can the console overflow with too many lines? I just want to know if it will eventually throw an IO exception or if number of Console.Writelines is virtually infinite. 回答1: No, it won't overflow. If you check the Options tab for a shortcut to the command window you will see a buffer size option. This specifies the maximum number of lines that will be stored

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

会有一股神秘感。 提交于 2019-12-23 04:19:27
问题 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"); //