Menu
  • HOME
  • TAGS

Getting “Input string was not in a correct format.” on SECOND step thru loop

c#,console.readline

int option = int.Parse(Console.ReadLine()); Focus on writing debuggable code: string input = Console.ReadLine(); int option = int.Parse(input); Now you can use the debugger, set a breakpoint on the Parse() statement. And you'll easily see why the Parse() method threw an exception. And yes, it does not like an empty...

exiting do while ReadLine loop not working

c#,console.readline

First of all I would use a List<int> to save the input values. This avoid the necessity to redimension the array and you could use the list as a normal array Second there is a lot of difference between the Console.Read and Console.ReadLine, the first returns one by one the...

console.readline display something before

c#,console.readline

Then you neeed Console.Write("Y = "); instead of Console.WriteLine("Y = "); ...

Increase buffer for Console.Readline?

.net,console.readline

From MSDN something like this ought to work: Stream inputStream = Console.OpenStandardInput(); byte[] bytes = new byte[1536]; // 1.5kb int outputLength = inputStream.Read(bytes, 0, 1536); The you can convert your byte array to a string with something like: var myStr = System.Text.Encoding.UTF8.GetString(bytes); ...