XmlReader.ReadElementContentAsDateTime 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
현재 요소를 읽고 내용을 개체로 DateTime 반환합니다.
오버로드
| Name | Description |
|---|---|
| ReadElementContentAsDateTime() |
현재 요소를 읽고 내용을 개체로 DateTime 반환합니다. |
| ReadElementContentAsDateTime(String, String) |
지정된 로컬 이름 및 네임스페이스 URI가 현재 요소의 이름과 일치하는지 확인한 다음, 현재 요소를 읽고 내용을 개체로 DateTime 반환합니다. |
ReadElementContentAsDateTime()
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
현재 요소를 읽고 내용을 개체로 DateTime 반환합니다.
public:
virtual DateTime ReadElementContentAsDateTime();
public virtual DateTime ReadElementContentAsDateTime();
abstract member ReadElementContentAsDateTime : unit -> DateTime
override this.ReadElementContentAsDateTime : unit -> DateTime
Public Overridable Function ReadElementContentAsDateTime () As DateTime
반품
개체로서의 요소 콘텐츠입니다 DateTime .
예외
XmlReader 요소에 위치하지 않습니다.
-또는-
XmlReader 이전 비동기 작업이 완료되기 전에 메서드가 호출되었습니다. 이 경우 InvalidOperationException "비동기 작업이 이미 진행 중입니다."라는 메시지와 함께 throw됩니다.
메서드는 인수를 사용하여 null 호출됩니다.
예제
다음 예제에서는 메서드를 ReadElementContentAsDateTime 사용하여 요소의 내용을 읽습니다 date .
using (XmlReader reader = XmlReader.Create("dataFile.xml")) {
reader.ReadToFollowing("date");
DateTime date = reader.ReadElementContentAsDateTime();
// If the current culture is "en-US",
// this writes "Wednesday, January 8, 2003".
Console.WriteLine(date.ToLongDateString());
}
Using reader As XmlReader = XmlReader.Create("dataFile.xml")
reader.ReadToFollowing("date")
Dim [date] As DateTime = reader.ReadElementContentAsDateTime()
' If the current culture is "en-US",
' this writes "Wednesday, January 8, 2003".
Console.WriteLine([date].ToLongDateString())
End Using
이 예제에서는 dataFile.xml 파일을 입력으로 사용합니다.
<root>
<stringValue>
<!--comment-->
<?some pi?>
text value of the element.
</stringValue>
<longValue>270000000000001</longValue>
<number>0</number>
<double>2E10</double>
<date>2003-01-08T15:00:00-00:00</date>
</root>
설명
이 메서드는 시작 태그, 요소의 내용을 읽고 판독기를 끝 요소 태그를 지나 이동합니다. 엔터티를 확장하고 처리 지침 및 주석을 무시합니다. 요소는 단순 콘텐츠만 포함할 수 있습니다. 즉, 자식 요소를 가질 수 없습니다.
콘텐츠를 입력 xsd:dateTime하면 판독기는 unboxed DateTime 개체를 반환합니다. 콘텐츠를 입력xsd:dateTime하지 않으면 판독기는 W3C XML 스키마 파트 2: 데이터 형식 권장 사항에 정의된 규칙에 따라 개체로 변환 DateTime 하려고 시도합니다.
메모
DateTime.Year로 콘텐츠가 입력될 때 xsd:gMonthDay 값을 신뢰할 수 없습니다.
XmlReader 이 경우 항상 값을 1904로 설정합니다 DateTime.Year .
자세한 내용은 XmlReader 참조 페이지의 설명 섹션을 참조하세요.
적용 대상
ReadElementContentAsDateTime(String, String)
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
- Source:
- XmlReader.cs
지정된 로컬 이름 및 네임스페이스 URI가 현재 요소의 이름과 일치하는지 확인한 다음, 현재 요소를 읽고 내용을 개체로 DateTime 반환합니다.
public:
virtual DateTime ReadElementContentAsDateTime(System::String ^ localName, System::String ^ namespaceURI);
public virtual DateTime ReadElementContentAsDateTime(string localName, string namespaceURI);
abstract member ReadElementContentAsDateTime : string * string -> DateTime
override this.ReadElementContentAsDateTime : string * string -> DateTime
Public Overridable Function ReadElementContentAsDateTime (localName As String, namespaceURI As String) As DateTime
매개 변수
- localName
- String
요소의 로컬 이름입니다.
- namespaceURI
- String
요소의 네임스페이스 URI입니다.
반품
개체로서의 요소 내용입니다 DateTime .
예외
XmlReader 요소에 위치하지 않습니다.
-또는-
XmlReader 이전 비동기 작업이 완료되기 전에 메서드가 호출되었습니다. 이 경우 InvalidOperationException "비동기 작업이 이미 진행 중입니다."라는 메시지와 함께 throw됩니다.
메서드는 인수를 사용하여 null 호출됩니다.
지정된 로컬 이름 및 네임스페이스 URI가 읽는 현재 요소의 이름과 일치하지 않습니다.
설명
이 메서드는 시작 태그, 요소의 내용을 읽고 판독기를 끝 요소 태그를 지나 이동합니다. 엔터티를 확장하고 처리 지침 및 주석을 무시합니다. 요소는 단순 콘텐츠만 포함할 수 있습니다. 즉, 자식 요소를 가질 수 없습니다.
콘텐츠를 입력 xsd:dateTime하면 판독기는 unboxed DateTime 개체를 반환합니다. 콘텐츠를 입력xsd:dateTime하지 않으면 판독기는 W3C XML 스키마 파트 2: 데이터 형식 권장 사항에 정의된 규칙에 따라 개체로 변환 DateTime 하려고 시도합니다.
메모
DateTime.Year로 콘텐츠가 입력될 때 xsd:gMonthDay 값을 신뢰할 수 없습니다.
XmlReader 이 경우 항상 값을 1904로 설정합니다 DateTime.Year .
자세한 내용은 XmlReader 참조 페이지의 설명 섹션을 참조하세요.