TagMapCollection.Item[Int32] 属性

定义

获取或设置位于指定索引位置的 TagMapInfo 对象。Gets or sets the TagMapInfo object at the specified index location.

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 对象的索引。The index of a TagMapInfo object in the collection.

属性值

TagMapInfo

指定索引处的 TagMapInfo 对象;如果该索引处没有对象,则为 nullThe TagMapInfo object at the specified index, or null if there is no object at that index.

示例

下面的代码示例说明如何使用 Item[] 属性。The following code example shows how to use the Item[] property. 此示例是为类提供的更大示例的一部分 PagesSectionThis example is part of a larger example provided for the PagesSection class.

// 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 指定的索引中已存在对象,则此属性将覆盖该对象; 否则,它将创建一个新的对象并将其添加到集合中。If a TagMapInfo object already exists at the specified index, this property overwrites it; otherwise, it creates a new object and adds it to the collection.

适用于

另请参阅