PeterO.Mail.MediaTypeBuilder

## PeterO.Mail.MediaTypeBuilder

public sealed class MediaTypeBuilder

Deprecated. Use MediaType.Builder instead.

A mutable media type object.

Member Summary

### MediaTypeBuilder Constructor

public MediaTypeBuilder(
    PeterO.Mail.MediaType mt);

Initializes a new instance of the PeterO.Mail.MediaTypeBuilder class using the data from another media type.

Parameters:

Exceptions:

### MediaTypeBuilder Constructor

public MediaTypeBuilder(
    string type,
    string subtype);

Initializes a new instance of the PeterO.Mail.MediaTypeBuilder class.

Parameters:

### MediaTypeBuilder Constructor

public MediaTypeBuilder();

Initializes a new instance of the PeterO.Mail.MediaTypeBuilder class, using the type “application/octet-stream” .

### IsMultipart

public bool IsMultipart { get; }

Deprecated. Instead of using this property, use the TopLevelType property and compare the result with the exact string ‘multipart’.

Gets a value indicating whether this is a multipart media type.

Returns:

true If this is a multipart media type; otherwise, false .

### IsText

public bool IsText { get; }

Deprecated. Instead of using this property, use the TopLevelType property and compare the result with the exact string ‘text’.

Gets a value indicating whether this is a text media type.

Returns:

true If this is a text media type; otherwise, false .

### SubType

public string SubType { get; set; }

Gets or sets this value’s subtype.

Returns:

A text string naming this object’s subtype, such as “plain” or “xml”.

Exceptions:

### TopLevelType

public string TopLevelType { get; set; }

Gets or sets this value’s top-level type.

Returns:

A text string naming this object’s top-level type, such as “text” or “audio” .

Exceptions:

### RemoveParameter

public PeterO.Mail.MediaTypeBuilder RemoveParameter(
    string name);

Removes a parameter from this builder object. Does nothing if the parameter’s name doesn’t exist.

Parameters:

Return Value:

This instance.

Exceptions:

### SetParameter

public PeterO.Mail.MediaTypeBuilder SetParameter(
    string name,
    string value);

Sets a parameter’s name and value for this media type.

Parameters:

Return Value:

This instance.

Exceptions:

### SetSubType

public PeterO.Mail.MediaTypeBuilder SetSubType(
    string str);

Sets this media type’s subtype, such as “plain” or “xml” . This method enables the pattern of method chaining (e.g., new...().Set...().Set...() ) unlike with the SubType property in.NET or the setSubType method (with small s) in Java.

Parameters:

Return Value:

This instance.

Exceptions:

### SetTopLevelType

public PeterO.Mail.MediaTypeBuilder SetTopLevelType(
    string str);

Sets this media type’s top-level type. This method enables the pattern of method chaining (e.g., new...().Set...().Set...() ) unlike with the TopLevelType property in.NET or the setTopLevelType method (with small s) in Java.

Parameters:

Return Value:

This instance.

Exceptions:

### ToMediaType

public PeterO.Mail.MediaType ToMediaType();

Converts this builder to an immutable media type object.

Return Value:

A MediaType object.

### ToString

public override string ToString();

Converts this object to a text string of the media type it represents, in the same form as MediaType.ToString .

Return Value:

A string representation of this object.

Back to MailLib start page.