Hi Frenz,
I created a Console Application in C:\ConsoleApp . I have a folder named "Messages" in my "D:\" . But when I try to use the DirectoryInfo Class to get the Root Directory it gave me erroneus results.
Code:
When I executed the above code, it gave me the FullName as "C:\Messages" instead of "D:\Messages". Even the "Root" is given as "C:\".
Similarly just for error elimination purposes, I deleted the above folders et stuff. Now I created the folder "Messages" in my "C:\" and the same project with the same code in my D:\ (same as the above example except interchanged).
Its getting even weird now, it returns me the FullName as "D:\Messages" instead of "C:\Messages" and the Root as "D:\".
Can neone give me a suitable explanation for the above behaviour?
Amicalement,
Neutrino
I created a Console Application in C:\ConsoleApp . I have a folder named "Messages" in my "D:\" . But when I try to use the DirectoryInfo Class to get the Root Directory it gave me erroneus results.
Code:
C#:
DirectoryInfo objDir = new DirectoryInfo("\\Messages);
string rootErrorDir = objDir.Root.ToString();
string rootErrDir = objDir.FullName.ToString();
Console.Write(rootErrorDir);
Console.Write(Environment.NewLine);
Console.Write(rootErrDir);
Console.Read();
When I executed the above code, it gave me the FullName as "C:\Messages" instead of "D:\Messages". Even the "Root" is given as "C:\".
Similarly just for error elimination purposes, I deleted the above folders et stuff. Now I created the folder "Messages" in my "C:\" and the same project with the same code in my D:\ (same as the above example except interchanged).
Its getting even weird now, it returns me the FullName as "D:\Messages" instead of "C:\Messages" and the Root as "D:\".
Can neone give me a suitable explanation for the above behaviour?
Amicalement,
Neutrino
Last edited by a moderator: