Method CreateFromBase64String
CreateFromBase64String(string, string)
Creates a new Attachment instance from a base64-encoded string.
public static Attachment CreateFromBase64String(string data, string name)
Parameters
datastringThe base64-encoded representation of the attachment content.
namestringThe logical file name to associate with the attachment.
Returns
- Attachment
A new Attachment initialized with the decoded bytes and given name.
Remarks
This is useful when receiving attachment data over text-based protocols or embedding within JSON/XML payloads.
Exceptions
- ArgumentNullException
Thrown if
dataornameisnull.- FormatException
Thrown if
datais not valid base64.- UnsupportedFileTypeException
Thrown if the decoded content does not match a supported format.