Share via


DiscoveryDocument.CanRead(XmlReader) 메서드

정의

전달된 XmlReaderDiscoveryDocument로 역직렬화될 수 있는지 여부를 나타내는 값을 반환합니다.

public:
 static bool CanRead(System::Xml::XmlReader ^ xmlReader);
public static bool CanRead (System.Xml.XmlReader xmlReader);
static member CanRead : System.Xml.XmlReader -> bool
Public Shared Function CanRead (xmlReader As XmlReader) As Boolean

매개 변수

xmlReader
XmlReader

테스트하여 XmlReader로 역직렬화될 수 있는지 여부를 확인할 DiscoveryDocument입니다.

반환

Boolean

XmlReaderDiscoveryDocument로 역직렬화될 수 있으면 true이고, 그렇지 않으면 false입니다.

예제

다음 코드 예제는 경우 검색 문서의 콘텐츠를 읽습니다 합니다 CanRead 속성은 true합니다.

// Check whether the given XmlTextReader is readable.
if ( DiscoveryDocument::CanRead( myXmlTextReader ) == true )
      
// Read the given XmlTextReader.
myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader );
else
      Console::WriteLine( "The supplied file is not readable" );
// Check whether the given XmlTextReader is readable.
if( DiscoveryDocument.CanRead( myXmlTextReader ) == true )
{
   // Read the given XmlTextReader.
   myDiscoveryDocument = DiscoveryDocument.Read( myXmlTextReader );
}
else
{
   Console.WriteLine( "The supplied file is not readable" );
}
' Check whether the given XmlTextReader is readable.
If DiscoveryDocument.CanRead(myXmlTextReader) = True Then
   ' Read the given XmlTextReader.
   myDiscoveryDocument = DiscoveryDocument.Read(myXmlTextReader)
Else
   Console.WriteLine("The supplied file is not readable")
End If

적용 대상

추가 정보