Method CreateFromText
CreateFromText(string, string)
Creates a new Attachment from a plain-text string.
public static Attachment CreateFromText(string text, string name)
Parameters
text
stringThe textual content to encode using UTF-8.
name
stringThe file name to associate with the content (for example, ending with
.txt
).
Returns
- Attachment
An Attachment carrying the provided text content.
Exceptions
- ArgumentNullException
Thrown if
text
orname
isnull
.