DiscoveryDocument.CanRead(XmlReader) Metodo

Definizione

Ottiene un valore che indica se l'oggetto XmlReader passato può essere deserializzato in un oggetto 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

Parametri

xmlReader
XmlReader

Oggetto XmlReader di cui viene eseguito il test per stabilire se può essere deserializzato in un oggetto DiscoveryDocument.

Restituisce

true se l'oggetto XmlReader può essere deserializzato in un oggetto DiscoveryDocument; in caso contrario, false.

Esempio

Nell'esempio di codice seguente viene letto il contenuto di un documento di individuazione, se la CanRead proprietà è 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

Si applica a

Vedi anche