Q:

C# program to list the users and their respective paths to their directories

I wish to is there any way in C# as a program to find out the list of users available in the  system i,e in My computer  and the path to their directories. i mean to say suppose there are 2 users
"User A" and "User B"
And their path I mean the User A's all the documents will be in D:\Documents and Settings\User A
and similarly for User B. 
Is there any way in C# to find out the list of users and the paths to their respective directories.

A:

You can do this
string users_reg_key=
   @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DocFolderPaths";

public string[] ListWinUsersList()
{
 //The registry key for reading user list.

 RegistryKey key =
 Registry.LocalMachine.OpenSubKey(users_reg_key, true);

 string[] winusers = "  ".Split(' ');//this resolve problem with assigned variable

 if (key != null && key.ValueCount > 0)
 {
     winusers = key.GetValueNames();
 }
 return winusers;
}

EDIT
to get directory try something like this
string path =  Directory.GetParent(Environment.GetFolderPath(Environment.
SpecialFolder.ApplicationData)).FullName;
if ( Environment.OSVersion.Version.Major >= 6 ) {
 path = Directory.GetParent(path);
}

