My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData in Csharp?

  • Thread starter Thread starter Pieter
  • Start date Start date
P

Pieter

Hi,

What's the equivalent in C# for
My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData (from
VB.NET)? I noticed that there isn't something like the My-object in C#? Or
is there?

What I need in this case is this: C:\Documents and
Settings\MyUserName\Application Data\MyCompany\Myapplication\1.0.0.0

But it would be great if I had a general solution that gives me (most) of
the My-object in Csharp :-)

Thanks a lot in advance,

Pieter
 
Hello, Pieter!

P> What's the equivalent in C# for
P> My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData
P> (from VB.NET)? I noticed that there isn't something like the My-object
P> in C#? Or is there?

You can use Environment.GetFolderPath(SpecialFolder.ApplicationData)

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
Greetings Pieter,

Assuming you are implementing a WinForms application, you can also use
Application.LocalUserAppDataPath and Application.UserAppDataPath static
properties to retrieve the same value (the Application class is defined
in the System.Windows.Forms namespace).

However, note that you may have problems in future if use the
AssemblyInformationalVersion attribute in combination with these
properties, see the following article for more information:

http://mattonsoftware.com/archive/2006/02/25/6.aspx

Cheers,
Matt
 
Back
Top