I'm a beginner in C# so please be patient with me. :) I'm practicing to write a simple C# code to understand how this language works. I have tried to read characters, integers and strings from console but between different tries/methods the buffer never empties. I would like to clear the buffer of console between each methods, for example:
using System;
namespace ElsoKonzolAppom
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Write something!");
string text1 = Console.ReadLine();
Console.WriteLine("Your text:" + text1);
//here, I would like to clear the buffer
int number1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Your first number:" + number1);
//here, I would like to clear the buffer
int number2 = Console.Read();
Console.WriteLine("Your second number:" + number2);
}
}
}
Probably this is something very trivial that I haven’t mastered yet.