Method CreateFromBase64String
CreateFromBase64String(string, string)
Creates a new Attachment instance from a base64-encoded string.
public static Attachment CreateFromBase64String(string data, string name)
Parameters
data
stringThe base64-encoded representation of the attachment content.
name
stringThe 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
data
orname
isnull
.- FormatException
Thrown if
data
is not valid base64.- UnsupportedFileTypeException
Thrown if the decoded content does not match a supported format.