다음을 통해 공유


XmlNode.LastChild 속성

노드의 마지막 자식을 가져옵니다.

네임스페이스: System.Xml
어셈블리: System.Xml(system.xml.dll)

구문

‘선언
Public Overridable ReadOnly Property LastChild As XmlNode
‘사용 방법
Dim instance As XmlNode
Dim value As XmlNode

value = instance.LastChild
public virtual XmlNode LastChild { get; }
public:
virtual property XmlNode^ LastChild {
    XmlNode^ get ();
}
/** @property */
public XmlNode get_LastChild ()
public function get LastChild () : XmlNode

속성 값

노드의 마지막 자식입니다. 이러한 노드가 없으면, Null 참조(Visual Basic의 경우 Nothing)이 반환됩니다.

예제

다음 예제에서는 가격 요소를 보여 줍니다.

Option Explicit
Option Strict

Imports System
Imports System.IO
Imports System.Xml

Public Class Sample
    
    Public Shared Sub Main()
        
        Dim doc As New XmlDocument()
        doc.LoadXml("<book ISBN='1-861001-57-5'>" & _
                    "<title>Pride And Prejudice</title>" & _
                    "<price>19.95</price>" & _
                    "</book>")
        
        Dim root As XmlNode = doc.FirstChild
        
        Console.WriteLine("Display the price element...")
        Console.WriteLine(root.LastChild.OuterXml)
    End Sub 'Main
End Class 'Sample
using System;
using System.IO;
using System.Xml;

public class Sample {

  public static void Main() {

    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<book ISBN='1-861001-57-5'>" +
                "<title>Pride And Prejudice</title>" +
                "<price>19.95</price>" +
                "</book>");

    XmlNode root = doc.FirstChild;

    Console.WriteLine("Display the price element...");
    Console.WriteLine(root.LastChild.OuterXml);
  }
}
#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
   XmlDocument^ doc = gcnew XmlDocument;
   doc->LoadXml( "<book ISBN='1-861001-57-5'>"
   "<title>Pride And Prejudice</title>"
   "<price>19.95</price>"
   "</book>" );
   XmlNode^ root = doc->FirstChild;
   Console::WriteLine( "Display the price element..." );
   Console::WriteLine( root->LastChild->OuterXml );
}
import System.*;
import System.IO.*;
import System.Xml.*;

public class Sample
{
    public static void main(String[] args)
    {
        XmlDocument doc = new XmlDocument();
        doc.LoadXml("<book ISBN='1-861001-57-5'>"
            + "<title>Pride And Prejudice</title>"
            + "<price>19.95</price>"
            + "</book>");

        XmlNode root = doc.get_FirstChild();

        Console.WriteLine("Display the price element...");
        Console.WriteLine(root.get_LastChild().get_OuterXml());
    } //main
} //Sample

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

XmlNode 클래스
XmlNode 멤버
System.Xml 네임스페이스