ContentType.Parameters プロパティ
アセンブリ: System (system.dll 内)

名前と値のペアを格納している書き込み可能な StringDictionary。

ContentType オブジェクトの作成時に、Content-Header のすべての値を指定してこのパラメータを設定できます。また、Parameters プロパティによって返される StringDictionary にパラメータを追加することもできます。
パラメータのエントリをディクショナリに追加する場合は、パラメータの名前がそのエントリのキーで、パラメータの値がそのエントリの値です。
Content-Type ヘッダーの構文の詳細は、RFC 2045 セクション 5.1 に記述されています。RFC 2046 では、MIME メディア タイプとそれらに関連付けられたパラメータに関する詳細情報が提供されています。これらの RFC については http://www.ietf.org を参照してください。

このプロパティによって返されるディクショナリ内の値を表示するコード例を次に示します。
public static void CreateMessageWithMultipleViews(string server, string recipients) { // Create a message and set up the recipients. MailMessage message = new MailMessage( "jane@contoso.com", recipients, "This e-mail message has multiple views.", "This is some plain text."); // Construct the alternate body as HTML. string body = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; body += "<HTML><HEAD><META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">"; body += "</HEAD><BODY><DIV><FONT face=Arial color=#ff0000 size=2>this is some HTML text"; body += "</FONT></DIV></BODY></HTML>"; // Add the alternate body to the message. AlternateView alternate = new AlternateView(body, MediaTypeNames.Text.Html); message.AlternateViews.Add(alternate); // Send the message. SmtpClient client = new SmtpClient(server); client.Credentials = CredentialCache.DefaultNetworkCredentials; client.Send(message); // Display the values in the ContentType for the attachment. ContentType c = alternate.ContentType; Console.WriteLine("Content type"); Console.WriteLine(c.ToString()); Console.WriteLine("Boundary {0}", c.Boundary); Console.WriteLine("CharSet {0}", c.CharSet); Console.WriteLine("MediaType {0}", c.MediaType); Console.WriteLine("Name {0}", c.Name); Console.WriteLine("Parameters: {0}", c.Parameters.Count); foreach (DictionaryEntry d in c.Parameters) { Console.WriteLine("{0} = {1}", d.Key, d.Value); } Console.WriteLine(); alternate.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.Parameters プロパティを検索する場合は、下記のリンクをクリックしてください。

- ContentType.Parameters プロパティのページへのリンク