Find length of a String using C#

In this article we will discuss about how to find the length of the string in C#.
  • 7099

The Length property of the string class returns the number of characters in a string including white spaces.

The following code snippet returns the size of a string and displays on the console.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;
namespace ConsoleApplication4
    class Program
        static void Main(string[] args)
            string nameString = "Mahesh Chand";
            Console.WriteLine("Size of string {0}", nameString.Length);


Ask Your Question 
Got a programming related question? You may want to post your question here


More Articles

© 2020 DotNetHeaven. All rights reserved.