Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (23 sloc) 917 Bytes
// Description: C# Extension Methods | Enhance the .NET Framework and .NET Core with over 1000 extension methods.
// Website & Documentation: https://csharp-extension.com/
// Issues: https://github.com/zzzprojects/Z.ExtensionMethods/issues
// License (MIT): https://github.com/zzzprojects/Z.ExtensionMethods/blob/master/LICENSE
// More projects: https://zzzprojects.com/
// Copyright © ZZZ Projects Inc. All rights reserved.
public static partial class Extensions
{
/// <summary>
/// An object extension method that query if '@this' is valid byte.
/// </summary>
/// <param name="this">The @this to act on.</param>
/// <returns>true if valid byte, false if not.</returns>
public static bool IsValidByte(this object @this)
{
if (@this == null)
{
return true;
}
byte result;
return byte.TryParse(@this.ToString(), out result);
}
}
You can’t perform that action at this time.