英語で読む

次の方法で共有


UriTemplateTable コンストラクター

定義

UriTemplateTable クラスの新しいインスタンスを初期化します。

オーバーロード

UriTemplateTable()

UriTemplateTable クラスの新しいインスタンスを初期化します。

UriTemplateTable(IEnumerable<KeyValuePair<UriTemplate,Object>>)

指定したキーと値のペアのコレクションを使用して、UriTemplateTable クラスの新しいインスタンスを初期化します。

UriTemplateTable(Uri)

指定したベース アドレスを使用して UriTemplateTable クラスの新しいインスタンスを初期化します。

UriTemplateTable(Uri, IEnumerable<KeyValuePair<UriTemplate,Object>>)

指定したベース アドレスと、キーと値のペアのコレクションを使用して、UriTemplateTable クラスの新しいインスタンスを初期化します。

UriTemplateTable()

UriTemplateTable クラスの新しいインスタンスを初期化します。

C#
public UriTemplateTable ();

UriTemplateTable クラスを初期化する方法を次の例に示します。

C#
Uri prefix = new Uri("http://localhost/");

//Create a series of templates
UriTemplate weatherByCity  = new UriTemplate("weather/{state}/{city}");
UriTemplate weatherByCountry = new UriTemplate("weather/{country}/{village}");
UriTemplate weatherByState = new UriTemplate("weather/{state}");
UriTemplate traffic = new UriTemplate("traffic/*");
UriTemplate wildcard = new UriTemplate("*");

//Create a template table
UriTemplateTable table = new UriTemplateTable(prefix);
//Add each template to the table with some associated data
table.KeyValuePairs.Add(new KeyValuePair<UriTemplate, Object>(weatherByCity, "weatherByCity"));
table.KeyValuePairs.Add(new KeyValuePair<UriTemplate, Object>(weatherByCountry, "weatherByCountry"));
table.KeyValuePairs.Add(new KeyValuePair<UriTemplate, Object>(weatherByState, "weatherByState"));
table.KeyValuePairs.Add(new KeyValuePair<UriTemplate, Object>(traffic, "traffic"));

table.MakeReadOnly(true);

適用対象

.NET Framework 4.8.1 およびその他のバージョン
製品 バージョン
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

UriTemplateTable(IEnumerable<KeyValuePair<UriTemplate,Object>>)

指定したキーと値のペアのコレクションを使用して、UriTemplateTable クラスの新しいインスタンスを初期化します。

C#
public UriTemplateTable (System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<UriTemplate,object>> keyValuePairs);

パラメーター

keyValuePairs
IEnumerable<KeyValuePair<UriTemplate,Object>>

キーと値のペアのコレクションは、URI テンプレートと関連付けられたデータで構成されます。

UriTemplateTable クラスを初期化する方法を次の例に示します。

C#
//Create a series of templates
UriTemplate weatherByCity = new UriTemplate("weather/{state}/{city}");
UriTemplate weatherByCountry = new UriTemplate("weather/{country}/{village}");
UriTemplate weatherByState = new UriTemplate("weather/{state}");
UriTemplate traffic = new UriTemplate("traffic/*");
UriTemplate wildcard = new UriTemplate("*");

//Add each template to the table with some associated data
List<KeyValuePair<UriTemplate,Object>> list = new List<KeyValuePair<UriTemplate,object>>();
list.Add(new KeyValuePair<UriTemplate, Object>(weatherByCity, "weatherByCity"));
list.Add(new KeyValuePair<UriTemplate, Object>(weatherByCountry, "weatherByCountry"));
list.Add(new KeyValuePair<UriTemplate, Object>(weatherByState, "weatherByState"));
list.Add(new KeyValuePair<UriTemplate, Object>(traffic, "traffic"));

//Create a template table
UriTemplateTable table = new UriTemplateTable(list);
table.BaseAddress = new Uri("http://localhost/");
table.MakeReadOnly(true);

適用対象

.NET Framework 4.8.1 およびその他のバージョン
製品 バージョン
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

UriTemplateTable(Uri)

指定したベース アドレスを使用して UriTemplateTable クラスの新しいインスタンスを初期化します。

C#
public UriTemplateTable (Uri baseAddress);

パラメーター

baseAddress
Uri

ベース アドレスを格納する Uri インスタンス。

次の例は、このコンストラクターを呼び出す方法を示しています。

C#
Uri prefix = new Uri("http://localhost/");

//Create a series of templates
UriTemplate weatherByCity  = new UriTemplate("weather/{state}/{city}");
UriTemplate weatherByCountry = new UriTemplate("weather/{country}/{village}");
UriTemplate weatherByState = new UriTemplate("weather/{state}");
UriTemplate traffic = new UriTemplate("traffic/*");
UriTemplate wildcard = new UriTemplate("*");

//Create a template table
UriTemplateTable table = new UriTemplateTable(prefix);
//Add each template to the table with some associated data
table.KeyValuePairs.Add(new KeyValuePair<UriTemplate, Object>(weatherByCity, "weatherByCity"));
table.KeyValuePairs.Add(new KeyValuePair<UriTemplate, Object>(weatherByCountry, "weatherByCountry"));
table.KeyValuePairs.Add(new KeyValuePair<UriTemplate, Object>(weatherByState, "weatherByState"));
table.KeyValuePairs.Add(new KeyValuePair<UriTemplate, Object>(traffic, "traffic"));

table.MakeReadOnly(true);

適用対象

.NET Framework 4.8.1 およびその他のバージョン
製品 バージョン
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

UriTemplateTable(Uri, IEnumerable<KeyValuePair<UriTemplate,Object>>)

指定したベース アドレスと、キーと値のペアのコレクションを使用して、UriTemplateTable クラスの新しいインスタンスを初期化します。

C#
public UriTemplateTable (Uri baseAddress, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<UriTemplate,object>> keyValuePairs);

パラメーター

baseAddress
Uri

ベース アドレスを格納する Uri インスタンス。

keyValuePairs
IEnumerable<KeyValuePair<UriTemplate,Object>>

キーと値のペアのコレクションは、URI テンプレートと関連付けられたデータで構成されます。

次の例は、このコンストラクターを呼び出す方法を示しています。

C#
Uri baseAddress = new Uri("http://localhost/");
//Create a series of templates
UriTemplate weatherByCity = new UriTemplate("weather/{state}/{city}");
UriTemplate weatherByCountry = new UriTemplate("weather/{country}/{village}");
UriTemplate weatherByState = new UriTemplate("weather/{state}");
UriTemplate traffic = new UriTemplate("traffic/*");
UriTemplate wildcard = new UriTemplate("*");

//Add each template to the table with some associated data
List<KeyValuePair<UriTemplate, Object>> list = new List<KeyValuePair<UriTemplate, object>>();
list.Add(new KeyValuePair<UriTemplate, Object>(weatherByCity, "weatherByCity"));
list.Add(new KeyValuePair<UriTemplate, Object>(weatherByCountry, "weatherByCountry"));
list.Add(new KeyValuePair<UriTemplate, Object>(weatherByState, "weatherByState"));
list.Add(new KeyValuePair<UriTemplate, Object>(traffic, "traffic"));

//Create a template table
UriTemplateTable table = new UriTemplateTable(baseAddress, list);
table.MakeReadOnly(true);

適用対象

.NET Framework 4.8.1 およびその他のバージョン
製品 バージョン
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1