Compare Two Strings in C# (case sensitivity or not) – Programming, Pseudocode Example, C# Programming Example
C# C# Console If Else Statement

Compare Two Strings in C# (case sensitivity or not)

In this examples, we’ll learn how to compare two strings in C# Console Application using case sensitive and case insensitive.

Example 1: Compare Two Strings with case sensivity.

C# Code:

 

Example 2: Compare Two Strings using String.Equals with case

sensitivity

 

When you run the program, the output will be:

 

 

Example 3: Compare two strings without case sensitivity. 

 

Example 4: Compare two strings without case sensitivity using

String.Equals. 

 

When you run the program, the output will be:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.