ContentType.ToString メソッド
アセンブリ: System (system.dll 内)

Dim instance As ContentType Dim returnValue As String returnValue = instance.ToString
この ContentType の現在の設定を格納している String。

この ContentType を作成するために使用する文字列が指定されていて、プロパティ値が変更されていない場合、ToString メソッドの値はその文字列を格納しています。この ContentType が作成された後、文字列が指定されていないか 1 つ以上のプロパティ値が変更されている場合、ToString の値は現在のプロパティ値を使用して作成された Content-Type ヘッダー形式の文字列です。この文字列には、"Content-type:" プレフィックスは含まれていません。
Content-Type ヘッダーの構文については、RFC 2045 セクション 5.1 (http://www.ietf.org) を参照してください。

ContentType の文字列形式を表示するコード例を次に示します。
public static void CreateMessageInlineAttachment2(string server, string textMessage) { // Create a message and set up the recipients. MailMessage message = new MailMessage( "jane@contoso.com", "ben@contoso.com", "A text message for you.", "Message: "); // Attach the message string to this e-mail message. Attachment data = new Attachment(textMessage); // Send textMessage as part of the e-mail body. message.Attachments.Add(data); ContentType content = data.ContentType; content.MediaType = MediaTypeNames.Text.Plain; //Send the message. // Include credentials if the server requires them. SmtpClient client = new SmtpClient(server); client.Credentials = CredentialCache.DefaultNetworkCredentials; client.Send(message); data.Dispose(); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からContentType.ToString メソッドを検索する場合は、下記のリンクをクリックしてください。

- ContentType.ToString メソッドのページへのリンク