[Fixed] Too many characters in character literal

You get the following error when you try to print anything on the console. Below is the complete error message you get.

error CS1012: Too many characters in character literal

Below is the mistake you might have done printing a text on the console.

Console.WriteLine('Hello World!');

C# compiler was expecting a single character since you have used character literal syntax. But you have given more than 1 character.

If you are using a single quote, give a single character inside it else you will get the above error. If you want to print more than 1 character, use double-quotes.

Console.WriteLine("Hello World!");

Thank you All!!! Hope you find this useful.

Leave a Reply

Up ↑

%d bloggers like this: