This snippet will give you the IsUppercase extension method for C# and VB.NET

Sample C#

public static bool IsUppercase(this string input)
{
	return Regex.IsMatch(input, @"^[A-Z]+$");
}

Sample VB.NET

<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsUppercase(input As String) As Boolean
	Return Regex.IsMatch(input, "^[A-Z]+$")
End Function

One thought on “IsUppercase extension method for C# and VB.NET”

Leave a Reply