Questions tagged [console.writeline]

Writes the specified data, followed by the current line terminator, to the standard output stream.

Writes the specified data, followed by the current line terminator, to the standard output stream.

253 questions
-2
votes
2 answers

Console.WriteLine invalid entry so display error

I am using Visual Studios where the below shown code is set. After you've entered the two paths, a message will come up stating the report will now produce, and the rest of the script (not shown below) will run and produce the Workbook. However, if…
user8591026
-2
votes
1 answer

Passing user input through a class and displaying it in the console

I am trying to create a C# console app, where if a user presses a number it will ask them to add a task, view current task, delete a task. I have created my first class to "Add a task" just get the user input, and then in the main method call that…
Ryan
  • 31
  • 9
-2
votes
1 answer

pls pls help me understand how Console.WriteLine() work

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Program { class Program { static void Main(string[] args) { int num, reverse = 0; …
-2
votes
2 answers

Output a List that contains a Class

I have list EmployeeList = new list(); I want to be able to output the objects created. I have different types of employees. In this example, I used type Class Manager. After some user input, I end that option with Employee…
Xoax
  • 77
  • 4
  • 13
-2
votes
1 answer

.NET Console.WriteLine() Console.SetOut

I have written a program to go through a fixed file and insert a | where needed, The program works fine and displays in the console correctly. The issue is I cannot get the line from the console to write to a line in the file. All attempts end up…
Arron
  • 25
  • 1
-2
votes
2 answers

About Encapsulation : properties

Case I : class example { private int roll; public int Roll { get { return roll; } set{ if (value > 0) { roll = value; } } } //public example() //{ // roll =…
-2
votes
1 answer

Cannot assign to 'writeline' because it is a 'method group'

The below code is giving me error "Cannot assign to 'writeline' because it is a 'method group;" at every Console.Writeline statement. I am trying to find out why but I could not find anything to point me in right direction. Any help appreciated.…
HereToLearn_
  • 1,150
  • 4
  • 26
  • 47
-2
votes
2 answers

Can I set the default format for a double when using Console.WriteLine

Are there any options for setting the default format when writing a double value to the console? I have many double values to output to the console, and I need set the format to two decimal places on all of them, like Math.Round(number, 2). Can I…
Peter
  • 11
  • 1
-2
votes
1 answer

Else...If statements not returning methods equations back properly in C#?

I'm banging my head trying to figure out why I can't get my equations to not return as Zero as it seems that for some reason the MathOperations methods aren't doing there job? If anyone could help I would much appreciate it. Thanks in advance! class…
user3303667
-2
votes
2 answers

I have to write a program in which after typing three names it should answer me with "Hello !"

I have to write a program in which after typing three names it should answer me with "Hello !", but there is problems with the Console.Writeline function... using System; using System.Collections.Generic; using System.Linq; using…
-3
votes
2 answers

With only one console writeline, how can I give multiple console writelines?

There are multiple Console.WriteLine() arguments between some values, but I don't want to give them all separately by copypaste, is there any way I can specify the number of WriteLine arguments with just one argument and it'll be done . here is some…
user19512202
-3
votes
4 answers

How to convert For Loop results into an Array then count the integers of the resulting Array in C#?

In C#, how would I go about converting the result of a For Loop into an Array and count (Display on the Console) the number of integers stored in that converted array? Please see below for what I have thus far: for (int i = 1; i < 100; i++) …
Mark
  • 1
  • 1
-3
votes
1 answer

Best practice to write new line in C#

I would like to know which is the best way to write new line in a console application which one is cross-platform. Which one is the best way to do it (if has…
BushWookie
  • 51
  • 1
  • 1
  • 8
-3
votes
2 answers

How to repeat a console.writeline x times in c#?

I'm trying to repeat a console.writeline x times (in C#). The x (type long) is a user input from a console.writeline. So if x is 2, I want 2 console.writelines to follow it. I tried fixing it with Enumerable.Repeat, but that did not work. Also a…
Amber
  • 45
  • 7
-3
votes
2 answers

How can I type "{0}" more quickly in Visual Studio?

In C#, it's common to have to type {0}, {1}, etc. when formatting strings with string.Format() or Console.WriteLine(). Considering its frequency, it's an awkward set of key strokes. But despite my searches, I couldn't find any sort of shorthand or…
Kyle Delaney
  • 11,616
  • 6
  • 39
  • 66
1 2 3
16
17