string str1 = "HELLO WORLD"; string str2 = str1.ToLower(); Console.WriteLine(str2);
string str = "CASE INSENSITIVE"; if (str.ToLower() == "case insensitive") { Console.WriteLine("String values are equal."); }In this example, we assigned a string value to the variable "str". Then, we used the ToLower method to convert all the characters in "str" to lowercase and compared it with a string in lowercase. If the two strings are equal, a message will be displayed on the console. The System ToLower method belongs to the System.String namespace.