Bonjour, j'affiche la valeur de la version du registre. Pour récupérer la valeur du registre, j'ai créé le code suivant.Problème lors de l'extraction de la valeur du registre
// Where WrmSpoAgentRoot= @"Software\syscon\Point Monitor\";
string keySpoPath = SpoRegistry.WrmSpoAgentRoot;
RegistryKey regkey = Registry.LocalMachine.OpenSubKey(keySpoPath);
Mais je veux attribuer cette valeur à un property..So j'ai créé une propriété « Wrmversion » .Mais quand je suis assigne cette valeur ,, variable « regkey » est pas assignant pour la propriété signifie IntelliSense ne produit pas « regkey » variable (le nom « regkey » n'existe pas dans le contexte actuel)
public string Wrmversion
{
get { return m_wrmversion; }
set { m_wrmversion = value; }
}
private string m_wrmversion = string)regkey.GetValue(
SpoRegistry.regValue_CurrentVersion);
est-il possible d'attribuer une valeur à la propriété comme
donc je ne cette façon, est-il un problème logique ,, public class WindowsAgent { chaîne publique Wrmversion {get {return m_wrmversion; } set {m_wrmversion = valeur; } } chaîne privée m_wrmversion = null; Public WindowsAgent() { string keySpoPath = SpoRegistry.WrmSpoAgentRoot; RegistryKey regkey = Registry.LocalMachine.OpenSubKey (keySpoPath); m_wrmversion = (chaîne de caractères) regkey.GetValue (SpoRegistry.regValue_CurrentVersion); } // WindowsRes – peter