AlternateView 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 AlternateView 的新執行個體。
多載
| 名稱 | Description |
|---|---|
| AlternateView(Stream) |
初始化一個新的實例 AlternateView ,使用指定的 Stream。 |
| AlternateView(String) |
初始化一個以指定檔案名稱的新實例 AlternateView 。 |
| AlternateView(Stream, ContentType) |
初始化一個新的實例 AlternateView ,並指定為 StreamContentType和 。 |
| AlternateView(Stream, String) |
初始化一個新的實例 AlternateView ,使用指定 Stream 且媒介類型的 。 |
| AlternateView(String, ContentType) |
初始化一個以指定檔案名稱和內容類型的新實例 AlternateView 。 |
| AlternateView(String, String) |
初始化一個以指定檔案名稱和媒體類型的新實例 AlternateView 。 |
備註
類別呼叫的新實例 AlternateView 也會透過呼叫其中一個 CreateAlternateViewFromString 方法來初始化。
AlternateView(Stream)
初始化一個新的實例 AlternateView ,使用指定的 Stream。
public:
AlternateView(System::IO::Stream ^ contentStream);
public AlternateView(System.IO.Stream contentStream);
new System.Net.Mail.AlternateView : System.IO.Stream -> System.Net.Mail.AlternateView
Public Sub New (contentStream As Stream)
參數
- contentStream
- Stream
一個包含此視角內容的串流。
例外狀況
contentStream 是 null。
備註
類別呼叫的新實例 AlternateView 也會透過呼叫其中一個 CreateAlternateViewFromString 方法來初始化。
適用於
AlternateView(String)
初始化一個以指定檔案名稱的新實例 AlternateView 。
public:
AlternateView(System::String ^ fileName);
public AlternateView(string fileName);
new System.Net.Mail.AlternateView : string -> System.Net.Mail.AlternateView
Public Sub New (fileName As String)
參數
- fileName
- String
包含此替代視角內容的檔案名稱。
例外狀況
fileName 是 null。
來電者沒有所需的權限。
發生了 I/O 錯誤,例如磁碟錯誤。
作業系統不允許對指定檔案處理的存取,例如當存取為寫入或讀寫且檔案處理設定為唯讀存取時。
備註
類別呼叫的新實例 AlternateView 也會透過呼叫其中一個 CreateAlternateViewFromString 方法來初始化。
適用於
AlternateView(Stream, ContentType)
初始化一個新的實例 AlternateView ,並指定為 StreamContentType和 。
public:
AlternateView(System::IO::Stream ^ contentStream, System::Net::Mime::ContentType ^ contentType);
public AlternateView(System.IO.Stream contentStream, System.Net.Mime.ContentType? contentType);
public AlternateView(System.IO.Stream contentStream, System.Net.Mime.ContentType contentType);
new System.Net.Mail.AlternateView : System.IO.Stream * System.Net.Mime.ContentType -> System.Net.Mail.AlternateView
Public Sub New (contentStream As Stream, contentType As ContentType)
參數
- contentStream
- Stream
這是一個包含此附件內容的串流。
- contentType
- ContentType
內容的型別。
例外狀況
contentStream 是 null。
contentType 不是有效值。
備註
類別呼叫的新實例 AlternateView 也會透過呼叫其中一個 CreateAlternateViewFromString 方法來初始化。
適用於
AlternateView(Stream, String)
初始化一個新的實例 AlternateView ,使用指定 Stream 且媒介類型的 。
public:
AlternateView(System::IO::Stream ^ contentStream, System::String ^ mediaType);
public AlternateView(System.IO.Stream contentStream, string? mediaType);
public AlternateView(System.IO.Stream contentStream, string mediaType);
new System.Net.Mail.AlternateView : System.IO.Stream * string -> System.Net.Mail.AlternateView
Public Sub New (contentStream As Stream, mediaType As String)
參數
- contentStream
- Stream
這是一個包含此附件內容的串流。
- mediaType
- String
內容屬於 MIME 媒體類型。
例外狀況
contentStream 是 null。
mediaType 不是有效值。
備註
類別呼叫的新實例 AlternateView 也會透過呼叫其中一個 CreateAlternateViewFromString 方法來初始化。
適用於
AlternateView(String, ContentType)
初始化一個以指定檔案名稱和內容類型的新實例 AlternateView 。
public:
AlternateView(System::String ^ fileName, System::Net::Mime::ContentType ^ contentType);
public AlternateView(string fileName, System.Net.Mime.ContentType? contentType);
public AlternateView(string fileName, System.Net.Mime.ContentType contentType);
new System.Net.Mail.AlternateView : string * System.Net.Mime.ContentType -> System.Net.Mail.AlternateView
Public Sub New (fileName As String, contentType As ContentType)
參數
- fileName
- String
包含此替代視角內容的檔案名稱。
- contentType
- ContentType
內容的型別。
例外狀況
fileName 是 null。
contentType 不是有效值。
來電者沒有所需的權限。
發生了 I/O 錯誤,例如磁碟錯誤。
作業系統不允許對指定檔案處理的存取,例如當存取為寫入或讀寫且檔案處理設定為唯讀存取時。
備註
類別呼叫的新實例 AlternateView 也會透過呼叫其中一個 CreateAlternateViewFromString 方法來初始化。
適用於
AlternateView(String, String)
初始化一個以指定檔案名稱和媒體類型的新實例 AlternateView 。
public:
AlternateView(System::String ^ fileName, System::String ^ mediaType);
public AlternateView(string fileName, string? mediaType);
public AlternateView(string fileName, string mediaType);
new System.Net.Mail.AlternateView : string * string -> System.Net.Mail.AlternateView
Public Sub New (fileName As String, mediaType As String)
參數
- fileName
- String
包含此替代視角內容的檔案名稱。
- mediaType
- String
內容屬於 MIME 媒體類型。
例外狀況
fileName 是 null。
mediaType 不是有效值。
來電者沒有所需的權限。
發生了 I/O 錯誤,例如磁碟錯誤。
作業系統不允許對指定檔案處理的存取,例如當存取為寫入或讀寫且檔案處理設定為唯讀存取時。
備註
類別呼叫的新實例 AlternateView 也會透過呼叫其中一個 CreateAlternateViewFromString 方法來初始化。