GroupCollection.Item[] 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
可透過整數或字串索引存取集合中的單一成員。
多載
| 名稱 | Description |
|---|---|
| Item[Int32] |
允許依整數索引存取集合的成員。 |
| Item[String] |
允許依字串索引存取集合的成員。 |
Item[Int32]
允許依整數索引存取集合的成員。
public:
property System::Text::RegularExpressions::Group ^ default[int] { System::Text::RegularExpressions::Group ^ get(int groupnum); };
public System.Text.RegularExpressions.Group this[int groupnum] { get; }
member this.Item(int) : System.Text.RegularExpressions.Group
Default Public ReadOnly Property Item(groupnum As Integer) As Group
參數
- groupnum
- Int32
要檢索集合成員的零為基礎索引。
屬性值
集合中由 groupnum指定的成員。
實作
備註
此性質即為類別的 GroupCollection 索引器。 它允許你透過陳述 foreach 句列舉集合的成員。
你也可以利用這個特性,依照索引號檢索個別捕獲的群組。 您可以透過取得該物業的價值 Count 來判斷收藏品的數量。 參數的有效值 groupnum 範圍從 0 到 集合中項目數少 1。
若 groupnum 不是集合成員的索引,或groupnum是未被輸入字串匹配的捕捉群的索引,則該方法回傳一個Group屬性為 Success 的物件,false其性質為 Group.Value ,且屬性為 Empty。
另請參閱
適用於
Item[String]
允許依字串索引存取集合的成員。
public:
property System::Text::RegularExpressions::Group ^ default[System::String ^] { System::Text::RegularExpressions::Group ^ get(System::String ^ groupname); };
public System.Text.RegularExpressions.Group this[string groupname] { get; }
member this.Item(string) : System.Text.RegularExpressions.Group
Default Public ReadOnly Property Item(groupname As String) As Group
參數
- groupname
- String
一個捕捉團體的名稱。
屬性值
集合中由 groupname指定的成員。
實作
備註
groupname 可以是由 (?<name>) 正則表達式中元素定義的捕獲群名稱,或是捕獲群數量的字串表示。
若 groupname 不是集合中擷取群的名稱,或 groupname 是未被輸入字串匹配的擷取群名稱,則該方法會回傳一個 Group 屬性為 Successfalse 、 Group.Value 屬性為 Empty的物件。