There’s actually something that caught me by surprise in .NET that I learned to accept that is along the same lines. I have some code that needs to look for a file in the Application Data folder area for a particular program. But I don’t want to use the CommonAppDataPath, as this creates a new folder for each version of the application. Therefore, I use the GetParent function combined with the folder name I always want to use like this:
dirStore = System.IO.Directory.GetParent(System.Windows.Forms.Application.CommonAppDataPath).ToString & “\filestore”But this actually creates the CommAppDataPath folder anyway! Maybe there’s an overload I’m missing and I learned to accept it. My data goes where I want it to in the long run and the users never look there anyway.
Posted from BLInk!
Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!