TagMapCollection.Item[Int32] 属性

定义

获取或设置 TagMapInfo 位于指定索引位置的对象。

public:
 property System::Web::Configuration::TagMapInfo ^ default[int] { System::Web::Configuration::TagMapInfo ^ get(int index); void set(int index, System::Web::Configuration::TagMapInfo ^ value); };
public System.Web.Configuration.TagMapInfo this[int index] { get; set; }
member this.Item(int) : System.Web.Configuration.TagMapInfo with get, set
Default Public Property Item(index As Integer) As TagMapInfo

参数

index
Int32

集合中对象的索引 TagMapInfo

属性值

TagMapInfo指定索引处的对象,或者null该索引处没有对象。

示例

下面的代码示例演示如何使用该 Item[] 属性。 此示例是PagesSection类所提供的一个大型示例的一部分。

// Get all current TagMappings in the collection.
for (int i = 0; i < pagesSection.TagMapping.Count; i++)
{
  Console.WriteLine("TagMapping {0}:", i);
  Console.WriteLine("  TagTypeName = '{0}'",
      pagesSection.TagMapping[i].TagType);
  Console.WriteLine("  MappedTagTypeName = '{0}'",
      pagesSection.TagMapping[i].MappedTagType);
}
' Get all current TagMappings in the collection.
Dim k As Int32
For k = 1 To pagesSection.TagMapping.Count
  Console.WriteLine("TagMapping {0}:", i)
  Console.WriteLine("  TagTypeName = '{0}'", _
   pagesSection.TagMapping(k).TagType)
  Console.WriteLine("  MappedTagTypeName = '{0}'", _
   pagesSection.TagMapping(k).MappedTagType)
Next

注解

TagMapInfo如果对象已存在于指定的索引处,则此属性将覆盖该对象;否则,它将创建一个新对象并将其添加到集合中。

适用于

另请参阅