Table of Contents

Method CreateFromText

Namespace
LMKit.Data
Assembly
LM-Kit.NET.dll

CreateFromText(string, string)

Creates a new Attachment instance from a plain-text string.

public static Attachment CreateFromText(string text, string name)

Parameters

text string

The text content to encode into the attachment. This will be converted to UTF-8 bytes.

name string

The file name to assign to the attachment. Used to infer its MIME type (e.g. “.txt” → text/plain).

Returns

Attachment

A new Attachment initialized with the UTF-8 bytes of text and the specified name.

Exceptions

ArgumentNullException

Thrown if text or name is null.