Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Expressions Vs Statements
public static string ToUppercaseExpression(this string currentString) =>
new string(currentString.Select(c => (char)(c < 97 || c > 122 ? c : c - 32)).ToArray());
public static string ToUppercaseStatements(this string currentString)
{
var returnValue = new StringBuilder();
foreach(var c in currentString)
{
if(c < 97 || c > 122)
{
returnValue.Append(c);
}
else
{
returnValue.Append((char)(c - 32));
}
}
return returnValue.ToString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.