Sometimes you may need to get all the characters in a string using C Sharp/C#. The following code gives you an example of how to get or display all the characters of a given string.

using System;

class MainClass

  public static void Main()
    string sampleString= "I Love Coding";

    for (int num = 0; num < sampleString.Length; num++)
      Console.WriteLine("sampleString[" + num + "] = " + sampleString[num]);



sampleString[0] = I
sampleString[1] =
sampleString[2] = L
sampleString[3] = o
sampleString[4] = v
sampleString[5] = e
sampleString[6] =
sampleString[7] = C
sampleString[8] = o
sampleString[9] = d
sampleString[10] = i
sampleString[11] = n
sampleString[12] = g




  1. Andres May 20, 2011 at 12:27 am

    Useful tips! I have been previously hunting for something like this for a long time now. Thank you!

  2. Malik May 21, 2011 at 10:52 am

    @Andres -> Thanks for the nice comment. Keep in touch. You can expect even more! Always welcome 🙂

  3. Powerful Xrumer Service June 16, 2011 at 4:57 pm

    hello there. looks like a nice article to me. bookmarking it and will read for sure.

  4. Xrumer Blast Service June 18, 2011 at 9:19 am

    nice post bro. waiting for the next part to show up

  5. Malik June 18, 2011 at 10:26 am

    @Powerful Xrumer Service- >Thanks for the nice comment. Keep in touch.

  6. Malik June 18, 2011 at 10:27 am

    @Xrumer Blast Service-> thanks for the nice comment… we will always try to give you the best we can… keep in touch… 🙂

  7. Myriam Schnetzer June 20, 2011 at 12:33 am

    Great review! This is exactly the type of article that needs to be shared around the web. Sad on the Yahoo for not positioning this post higher!


Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.