Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Finding length of a string in C#

Using Length property, total number of characters will be returned.
Remember that, Inner Space will also be considered.

  1. using System;
  2. using System.IO;
  3. using System.Text;
  4.  
  5. namespace forgetCode
  6. {
  7. class program1
  8. {
  9. static void Main(string[] args)
  10. {
  11. string firstString = "Forget code";
  12.  
  13. int iLength = firstString.Length;
  14.  
  15. Console.WriteLine("Length of the string is :"+iLength);
  16.  
  17. // Inner Space will also be considered
  18. }
  19. }
  20. }



Output:
Length of the string is : 11

..