RegistryKey.ToString Metodo

Definizione

Recupera una rappresentazione di stringa di questa chiave.

public:
 override System::String ^ ToString();
public override string ToString();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

Valori restituiti

Stringa che rappresenta la chiave. Se la chiave specificata non è valida (non è possibile trovare), null viene restituita.

Eccezioni

L'oggetto RegistryKey a cui si accede è chiuso (non è possibile accedere alle chiavi chiuse).

Esempio

Questo esempio di codice fa parte di un esempio più ampio fornito per la RegistryKey classe .

// Delete or close the new subkey.
Console::Write( "\nDelete newly created registry key? (Y/N) " );
if ( Char::ToUpper( Convert::ToChar( Console::Read() ) ) == 'Y' )
{
   Registry::CurrentUser->DeleteSubKeyTree( "Test9999" );
   Console::WriteLine( "\nRegistry key {0} deleted.", test9999->Name );
}
else
{
   Console::WriteLine( "\nRegistry key {0} closed.", test9999->ToString() );
   test9999->Close();
}
// Delete or close the new subkey.
Console.Write("\nDelete newly created registry key? (Y/N) ");
if(Char.ToUpper(Convert.ToChar(Console.Read())) == 'Y')
{
    Registry.CurrentUser.DeleteSubKeyTree("Test9999");
    Console.WriteLine("\nRegistry key {0} deleted.",
        test9999.Name);
}
else
{
    Console.WriteLine("\nRegistry key {0} closed.",
        test9999.ToString());
    test9999.Close();
}
' Delete or close the new subkey.
Console.Write(vbCrLf & "Delete newly created " & _
    "registry key? (Y/N) ")
If Char.ToUpper(Convert.ToChar(Console.Read())) = "Y"C Then
    Registry.CurrentUser.DeleteSubKeyTree("Test9999")
    Console.WriteLine(vbCrLf & "Registry key {0} deleted.", _
        test9999.Name)
Else
    Console.WriteLine(vbCrLf & "Registry key {0} closed.", _
        test9999.ToString())
    test9999.Close()
End If

Commenti

Il valore restituito include il percorso del Registro di sistema della chiave specificata e il valore esadecimale per la chiave. Il percorso del Registro di sistema include la radice assoluta della chiave specificata, inizia sempre in una delle chiavi di base per il Registro di sistema, ad esempio HKEY_LOCAL_MACHINE.

Si applica a

Vedi anche