Sdílet prostřednictvím


DiscoveryDocument.CanRead(XmlReader) Metoda

Definice

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

Testovaný XmlReader , zda lze deserializovat na DiscoveryDocument.

Návraty

truepokud XmlReader lze deserializovat na DiscoveryDocument; v opačném případě . false

Příklady

Následující příklad kódu čte obsah dokumentu zjišťování, pokud CanRead je truevlastnost .

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

Platí pro

Viz také