PeterO.Mail.MediaType.Builder

## PeterO.Mail.MediaType.Builder

public sealed class Builder

A mutable data type that allows a media type object to be built.

Member Summary

### Builder Constructor

public Builder(
    PeterO.Mail.MediaType mt);

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

Parameters:

Exceptions:

### Builder Constructor

public Builder(
    string type,
    string subtype);

Initializes a new instance of the PeterO.Mail.MediaType.Builder class.

Parameters:

### Builder Constructor

public Builder();

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

### 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.MediaType.Builder 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.MediaType.Builder 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.MediaType.Builder 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.MediaType.Builder 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.