C# String ToLower() Method

The ToLower() method in C# is used to convert all the characters in a string to lowercase. It returns a new string with all the characters converted to lowercase.

The syntax of the ToLower() method is as follows:

refer to:‮editfigi‬a.com
string lowerCaseString = string.ToLower();

For example, to convert a string to lowercase, you can use the following code:

string text = "Hello World";
string lowerCaseText = text.ToLower();
Console.WriteLine(lowerCaseText);  // Output: "hello world"

In this example, the ToLower() method is used to convert the string "Hello World" to lowercase. The resulting lowercase string "hello world" is assigned to the lowerCaseText variable, which is then printed to the console using the WriteLine() method.

Note that the ToLower() method does not modify the original string. Instead, it returns a new string with all the characters converted to lowercase. If you need to modify the original string, you can assign the result of the ToLower() method back to the original string variable.