次の方法で共有


XmlElementAttributes.Item プロパティ

コレクションから XmlElementAttribute を取得または設定します。

[C#] C# では、このプロパティは XmlElementAttributes クラスのインデクサになります。

Public Default Property Item( _
   ByVal index As Integer _) As XmlElementAttribute
[C#]
public XmlElementAttribute this[intindex] {get; set;}
[C++]
public: __property XmlElementAttribute* get_Item(intindex);public: __property void set_Item(intindex,   XmlElementAttribute*);
[JScript]
returnValue = XmlElementAttributesObject.Item(index);XmlElementAttributesObject.Item(index) = returnValue;またはreturnValue = XmlElementAttributesObject(index);XmlElementAttributesObject(index) = returnValue;

[JScript] JScript では、この型で定義されている既定のインデックス プロパティを使用することができます。しかし、独自のインデックス プロパティを明示的に定義することはできません。ただし、このクラスの expando 属性を指定すると、既定のインデックス プロパティが提供されます。提供されるインデックス プロパティの型は Object 型であり、インデックス型は String になります。

引数 [JScript]

  • index
    取得または設定するコレクション メンバの 0 から始まるインデックス。

パラメータ [Visual Basic, C#, C++]

  • index
    取得または設定するコレクション メンバの 0 から始まるインデックス。

プロパティ値

指定したインデックス位置にある XmlElementAttribute

使用例

[Visual Basic, C#, C++] XmlAttributes 内の最初の XmlElementAttribute を取得する例を次に示します。

 
Private Sub GetXmlElement(ByVal attrs As XmlAttributes)
    ' Get the first XmlElementAttribute in the collection.
    Dim att As XmlElementAttribute = attrs.XmlElements(0)
    
    ' Get the Type of the XmlElementAttribute and print it.
    Dim t As Type = att.Type
    Console.WriteLine(t.ToString())
End Sub
End Class

[C#] 
private void GetXmlElement(XmlAttributes attrs)
{
   // Get the first XmlElementAttribute in the collection.
   XmlElementAttribute att = attrs.XmlElements[0];

   // Get the Type of the XmlElementAttribute and print it.
   Type t = att.Type;
   Console.WriteLine(t.ToString());
}


[C++] 
private:
void GetXmlElement(XmlAttributes* attrs)
{
   // Get the first XmlElementAttribute in the collection.
   XmlElementAttribute* att = attrs->XmlElements->Item[0];

   // Get the Type of the XmlElementAttribute and print it.
   Type* t = att->Type;
   Console::WriteLine(t);
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

XmlElementAttributes クラス | XmlElementAttributes メンバ | System.Xml.Serialization 名前空間