DataUrlTryGetBytes(ReadOnlyMemoryChar, Byte, String) Method

Tries to retrieve the embedded data as a Byte array, and also an appropriate file type extension for this data.

Definition

Namespace: FolkerKinzel.DataUrls
Assembly: FolkerKinzel.DataUrls (in FolkerKinzel.DataUrls.dll) Version: 1.0.0+b1c843815044ca6fd87a144c9ff16386002c6473
C#
public static bool TryGetBytes(
	ReadOnlyMemory<char> dataUrl,
	out byte[]?? bytes,
	out string?? fileTypeExtension
)

Parameters

dataUrl  ReadOnlyMemoryChar
A read-only memory that contains a "data" URL according to RFC 2397.
bytes  Byte
If the method returns true, the parameter contains the embedded data. The parameter is passed uninitialized.
fileTypeExtension  String
If the method returns true, the parameter contains an appropriate file type extension for bytes. The extension starts with the period ".". The parameter is passed uninitialized.

Return Value

Boolean
true if dataUrl is a valid "data" URL, otherwise false.

Remarks

The method fails only if a decoding error occurs. The use of the method is particularly recommended if the embedded data of the "data" URL should be saved in a file.

See Also