Use Convert.TryFromBase64String from C# 7.2
public static bool IsBase64String(string base64)
{
Span<byte> buffer = new Span<byte>(new byte[base64.Length]);
return Convert.TryFromBase64String(base64, buffer , out int bytesParsed);
}
More Related Contents:
- Is string check returns false
- How do I encode and decode a base64 string?
- Regex Email validation
- How to check whether a string is a valid HTTP URL?
- How can I validate console input as integers?
- converting a base 64 string to an image and saving it
- Convert an image (selected by path) to base64 string
- GETting a URL with an url-encoded slash
- How do you remove invalid hexadecimal characters from an XML-based data source prior to constructing an XmlReader or XPathDocument that uses the data?
- Email address validation using ASP.NET MVC data type attributes
- C# Base64 String to JPEG Image
- The input is not a valid Base-64 string as it contains a non-base 64 character
- Using DataAnnotations with Entity Framework
- Xml validation using XSD schema
- Encode a FileStream to base64 with c#
- Custom Validation Attributes: Comparing two properties in the same model
- Validate JSON against JSON Schema C#
- DataAnnotations: Recursively validating an entire object graph
- C# Convert a Base64 -> byte[]
- MaxLength Attribute not generating client-side validation attributes
- Best way to check if a Data Table has a null value in it
- Really simple WPF form data validation – how to?
- Customize automatic response on validation error
- Writing a CompareTo DataAnnotation Attribute
- How to convert Bitmap to a Base64 string?
- Convert UTF-8 to base64 string
- Is the DataTypeAttribute validation working in MVC2?
- Opposite of [compare(” “)] data annotation in .net?
- MVC Form Validation on Multiple Fields
- Json.Net deserialize out of memory issue