---
title: "How to access registry keys in C#"  
description: "How to access registry keys in C#"  
author: "Anupam Mishra"  
published: 2016-01-20  
updated: 2016-01-21  
canonical: https://www.mindstick.com/forum/33899/how-to-access-registry-keys-in-c-sharp  
category: "c#"  
tags: ["c#", ".net"]  
reading_time: 1 minute  

---

# How to access registry keys in C#

I want to [retrieve](https://www.mindstick.com/forum/34400/how-to-retrieve-form-values-in-controller-action) a subkeys under the registry key(any [root](https://answers.mindstick.com/qa/49855/tell-me-what-is-root-port-in-spanning-tree-protocol) key) in my [local](https://www.mindstick.com/forum/546/how-to-create-local-user-in-windows-8) machine. Please give me a solution.\
thank you.

## Replies

### Reply by Anupam Mishra

Here, we want to access of existing **subkey** ([i have already created **subkeys**](https://www.mindstick.com/forum/33898/how-to-create-a-new-subkeys-under-registry). ) value.for retrieving **subkey** values, we used **GetValue** method . code is below: \

```
        RegistryKey key;                key = Registry.CurrentUser.OpenSubKey("Anupam Software");                String s = (String)key.GetValue("Anupam");                Console.WriteLine("Registry Value: " + s);
```

**Output:**

My Software


---

Original Source: https://www.mindstick.com/forum/33899/how-to-access-registry-keys-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
