PeterO.Mail.ContentDisposition.Builder
## PeterO.Mail.ContentDisposition.Builder
public sealed class Builder
A mutable data type that allows a content disposition to be built.
Member Summary
[DispositionType](#DispositionType)
- Gets or sets this value’s disposition type, such as “inline” or “attachment”.[IsMultipart](#IsMultipart)
- Deprecated: Irrelevant for content dispositions; will be removed in the future.[IsText](#IsText)
- Deprecated: Irrelevant for content dispositions; will be removed in the future.[RemoveParameter(string)](#RemoveParameter_string)
- Removes a parameter from this content disposition.[SetDispositionType(string)](#SetDispositionType_string)
- Sets the disposition type, such as “inline”.[SetParameter(string, string)](#SetParameter_string_string)
- Sets a parameter of this content disposition.[ToDisposition()](#ToDisposition)
- Converts this object to an immutable ContentDisposition object.[ToString()](#ToString)
- Converts this object to a text string.
public Builder( PeterO.Mail.ContentDisposition mt);
Initializes a new instance of the PeterO.Mail.DispositionBuilder class using the data from the given content disposition.
Parameters:
- mt: The parameter mt is a ContentDisposition object.
Exceptions:
- System.ArgumentNullException: The parameter mt is null.
public Builder( string type);
Initializes a new instance of the PeterO.Mail.ContentDisposition.Builder class using the given disposition type.
Parameters:
- type: The parameter type is a text string.
Exceptions:
-
System.ArgumentNullException: The parameter type is null.
-
System.ArgumentException: Type is empty.
public Builder();
Initializes a new instance of the PeterO.Mail.DispositionBuilder class using the disposition type “attachment” .
public string DispositionType { get; set; }
Gets or sets this value’s disposition type, such as “inline” or “attachment”.
Returns:
This value’s disposition type, such as “inline” or “attachment” .
Exceptions:
-
System.ArgumentNullException: The property is being set and the value is null.
-
System.ArgumentException: The property is being set and the value is an empty string.
public bool IsMultipart { get; }
Deprecated. Irrelevant for content dispositions; will be removed in the future.
Gets a value indicating whether this is a multipart media type.
Returns:
true
If this is a multipart media type; otherwise, false
.
public bool IsText { get; }
Deprecated. Irrelevant for content dispositions; will be removed in the future.
Gets a value indicating whether this is a text media type.
Returns:
true
If this is a text media type; otherwise, false
.
public PeterO.Mail.ContentDisposition.Builder RemoveParameter( string name);
Removes a parameter from this content disposition. Does nothing if the parameter’s name doesn’t exist.
Parameters:
- name: The parameter to remove. The name is compared using a basic case-insensitive comparison. (Two strings are equal in such a comparison, if they match after converting the basic upper-case letters A to Z (U+0041 to U+005A) in both strings to basic lower-case letters.).
Return Value:
This instance.
Exceptions:
- System.ArgumentNullException: The parameter name is null.
public PeterO.Mail.ContentDisposition.Builder SetDispositionType( string str);
Sets the disposition type, such as “inline”. This method enables the pattern of method chaining (e.g., new
...().Set...().Set...()
) unlike with the DispositionType property in .NET or the setDispositionType method (with small s) in Java.
Parameters:
- str: The parameter str is a text string.
Return Value:
This instance.
Exceptions:
-
System.ArgumentNullException: The parameter str is null.
-
System.ArgumentException: Str is empty.
public PeterO.Mail.ContentDisposition.Builder SetParameter( string name, string value);
Sets a parameter of this content disposition.
Parameters:
-
name: Name of the parameter to set. If this name already exists (compared using a basic case-insensitive comparison), it will be overwritten. (Two strings are equal in a basic case-insensitive comparison, if they match after converting the basic upper-case letters A to Z (U+0041 to U+005A) in both strings to basic lower-case letters.).
-
value: Value of the parameter to set.
Return Value:
This instance.
Exceptions:
-
System.ArgumentNullException: Either value or name is null.
-
System.ArgumentException: The parameter name is empty, or it isn’t a well-formed parameter name.
public PeterO.Mail.ContentDisposition ToDisposition();
Converts this object to an immutable ContentDisposition object.
Return Value:
A MediaType object.
public override string ToString();
Converts this object to a text string.
Return Value:
A string representation of this object.