DiscoveryDocument.CanRead(XmlReader) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a value indicating whether the passed XmlReader can be deserialized into a DiscoveryDocument.
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
Parameters
- xmlReader
- XmlReader
The XmlReader that is tested whether it can be deserialized into a DiscoveryDocument.
Returns
true
if XmlReader can be deserialized into a DiscoveryDocument; otherwise, false
.
Examples
The following code example reads in the contents of a discovery document, if the CanRead property is true
.
// Check whether the given XmlTextReader is readable.
if ( DiscoveryDocument::CanRead( myXmlTextReader ) )
// 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 ))
{
// 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
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET