---
title: "How to create a new subkeys under registry"  
description: "How to create a new subkeys under registry"  
author: "Anupam Mishra"  
published: 2016-01-20  
updated: 2016-01-21  
canonical: https://www.mindstick.com/forum/33898/how-to-create-a-new-subkeys-under-registry  
category: "c#"  
tags: ["c#", ".net"]  
reading_time: 1 minute  

---

# How to create a new subkeys under registry

I want to create a **subkeys** under the **[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 appropriate example to create a new subkey.\
thank you.

## Replies

### Reply by Anupam Mishra

In C#, Register class is defined under Microsoft.Win32 namespace . Register class is used to manipulate the system registry. It represents a Key level node in the windows registry. The registry acts as information for the operating system and application on a computer. Register keys are the base unit of registry. Each key have multiple values alone with it.\
For creation of new subkey under the registry, we are using CreateSubKey method to creates a new subkey or opens an existing subkey for write access.\

```
    RegistryKey key;          key = Registry.CurrentUser.CreateSubKey("Anupam Software"); // you can change root directory  e.g. LocalMachine          key.SetValue("Anupam", "My Software");          key.Close();
```

\
It will create a subkey under the current User(HKEY_USERS) like below screen :\
![How to create a new subkeys under registry](https://www.mindstick.com/mindstickforums/e6a97730-9085-46ad-a3b5-aa06dd73ada6/images/9baa8966-ef10-4bfa-9632-7263d6da99fe.png)\
\


---

Original Source: https://www.mindstick.com/forum/33898/how-to-create-a-new-subkeys-under-registry

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
