Sdílet prostřednictvím


DiscoveryDocument.CanRead(XmlReader) Metoda

Definice

Vrátí hodnotu označující, zda lze předat XmlReader deserializovat do 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

Parametry

xmlReader
XmlReader

Testuje XmlReader se, zda lze deserializovat do DiscoveryDocument.

Návraty

true lze-li XmlReader deserializovat do DiscoveryDocument; jinak , false.

Příklady

Následující příklad kódu čte v obsahu dokumentu zjišťování, pokud CanRead(XmlReader) je truemetoda .

// 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

Platí pro

Viz také