To convert a string to upper case in C#, you can use the ToUpper()
method from the String
class. Here's an example:
main.cs117 chars5 lines
This will output HELLO, WORLD!
. The ToUpper()
method converts all characters in the string to their uppercase equivalent.
Note that the original string myString
remains unchanged, and the converted string is assigned to upperCaseString
.
Remember to include the using System;
statement at the beginning of your code to use the Console.WriteLine()
method.
gistlibby LogSnag