Look at Intellisense and then look at the docs Char.IsUpper
I would make this an extension method
public static class StringExtensions
{
public static bool IsUppercase(this string s) => s.All(char.IsUpper);
}
Then write a test method
[TestMethod]
public void IsAllTest()
{
var name = "karen";
Assert.IsFalse(name.IsUppercase());
name = "KAREN";
Assert.AreEqual(name, "KAREN");
}
This might make more sense
public static class StringExtensions
{
public static bool IsUppercase(this string source) => source.All(char.IsUpper);
public static bool IsUpperCase(this string source) => (from character in source where char.IsUpper(character) select character).Count() == source.Length;
}
[TestMethod]
public void IsAllTest()
{
var name = "karen";
Assert.IsFalse(name.IsUpperCase());
name = "KAREN";
Assert.IsTrue(name.IsUpperCase());
}
Then back to this which uses a method group and is harder for novice developers to grasp
[DebuggerStepThrough]
public static bool IsUpperCase(this string source) =>
(source.Where(char.IsUpper)).Count() == source.Length;