语言

TagPrefixCollection.Item[Int32] 属性

定义

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

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

参数

index
Int32

集合中对象的索引 TagPrefixInfo 。

属性值

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

示例

下面的代码示例演示如何使用该 Item[] 属性。 该代码示例是 PagesSection 类中的一个较大示例的一部分。

// Get all current Controls in the collection.
for (int i = 0; i < pagesSection.Controls.Count; i++)
{
  Console.WriteLine("Control {0}:", i);
  Console.WriteLine("  TagPrefix = '{0}' ",
      pagesSection.Controls[i].TagPrefix);
  Console.WriteLine("  TagName = '{0}' ",
      pagesSection.Controls[i].TagName);
  Console.WriteLine("  Source = '{0}' ",
      pagesSection.Controls[i].Source);
  Console.WriteLine("  Namespace = '{0}' ",
      pagesSection.Controls[i].Namespace);
  Console.WriteLine("  Assembly = '{0}' ",
      pagesSection.Controls[i].Assembly);
}
' Get all current Controls in the collection.
Dim j As Int32
For j = 0 To pagesSection.Controls.Count - 1
  Console.WriteLine("Control {0}:", j)
  Console.WriteLine("  TagPrefix = '{0}' ", _
   pagesSection.Controls(j).TagPrefix)
  Console.WriteLine("  TagName = '{0}' ", _
   pagesSection.Controls(j).TagName)
  Console.WriteLine("  Source = '{0}' ", _
   pagesSection.Controls(j).Source)
  Console.WriteLine("  Namespace = '{0}' ", _
   pagesSection.Controls(j).Namespace)
  Console.WriteLine("  Assembly = '{0}' ", _
   pagesSection.Controls(j).Assembly)
Next

注解

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

适用于

另请参阅