Way to increment a character in C#

CsharpProgrammingServer Side Programming

Firstly, set a character−

char ch = 'K';

Now simply increment it like this −

ch++;

If you will print the character now, it would be the next character as shown in the following example −

Example

 Live Demo

using System;
using System.Collections.Generic;

class Demo {
   static void Main() {
      char ch = 'K';

      Console.WriteLine("Initial character:"+ch);

      // increment character
      ch++;
      Console.WriteLine("New character:"+ch);
   }
}

Output

Initial character:K
New character:L
raja
Published on 10-Aug-2018 11:48:58
Advertisements