String Equal() Method in C#



String Equals() Method in C#

Equals() – The C# Equals() method used to check if the given two strings are same or not.

The Equals() method returns bool value true / false as output.
If the both strings are same then this method returns true value and if not then returns false value as output.

C# Example of Equals()

meeraacademy.com
String Equals() Example in C#

In above example checks the string value with “Meera”. In first case input string value is “Meera”. Then it returns True as output. In second case imputed string is “Meera aca”. It is not equal to give string so result will be False.

C# code for Equals() button click :

protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = TextBox1.Text.Equals("Meera");
}

Subscribe us

If you liked this c#.net post, then please subscribe to our YouTube Channel for more c#.net video tutorials.

We hope that this C#.net tutorial helped you to understand String Equals() method.


Next asp.net tutorial we will learn about C# String EndsWith() and StartsWith() Function.


Leave a Reply

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