Getsuyodev, Programming is mainly used when constructing an application. Programming requires knowledge of application domains, algorithms, and programming language expertise. Programming can be developed in different logic based on developer knowledge.

How to use C# string Length

The Length property in String Class returned the number of characters occurred in a String.

int string.length


  • Integer: The number of characters in the specified String.


 "This is a Test".Length returns 14.
using System;
using System.Windows.Forms;

namespace WindowsApplication1
    public partial class Form1 : Form
        public Form1()

        private void button1_Click(object sender, EventArgs e)
            string str = null;
            str = "This is a Test";

When you execute this C# source code, you will get 14 in the messagebox.

Comments are closed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More