Logging key value pairs in a List<string>

If you have a List<string> with entries: [0] = Parameter1.Name [1] = Parameter1.Value [2] = Parameter2.Name [3] = Parameter2.Value and want to convert this list to a string like Parameter1.Name = [Parameter1.Value] Parameter2.Name = [Parameter2.Value], you can use the following code:   /// <summary> /// Convert a List of strings …

How to determine the folders used by a Microsoft Visual Studio unit test

You can use the directories used by a Microsoft Visual Studio unit test, by using the TestContext object. [TestMethod] public void GetUnittestFolders() { Console.WriteLine(string.Format("CurrentTestOutcome [{0}]", TestContext.CurrentTestOutcome)); Console.WriteLine(string.Format("DeploymentDirectory [{0}]", TestContext.DeploymentDirectory)); Console.WriteLine(string.Format("ResultsDirectory [{0}]", TestContext.ResultsDirectory)); Console.WriteLine(string.Format("TestDeploymentDir [{0}]", TestContext.TestDeploymentDir)); Console.WriteLine(string.Format("TestDir [{0}]", TestContext.TestDir)); Console.WriteLine(string.Format("TestLogsDir [{0}]", TestContext.TestLogsDir)); Console.WriteLine(string.Format("TestRunDirectory [{0}]", TestContext.TestRunDirectory)); Console.WriteLine(string.Format("TestRunResultsDirectory [{0}]", TestContext.TestRunResultsDirectory)); }     …

Cleaning a Microsoft Visual Studio solution after setting all files to read-only

Making ".\bin", ".\Release", ".\Debug", ".\obj" not read-only, after accidentally setting the root folder of you’re Microsoft Visual Studio solution to "read-only". You can use this script:     string sourceFolder = @"C:\Projects"; foreach (string folder in Directory.GetDirectories(sourceFolder, "*", SearchOption.AllDirectories)) { if (folder.EndsWith(@"\obj") || folder.EndsWith(@"\bin") || folder.EndsWith(@"\Release") || folder.EndsWith(@"\Debug"))     {       DirectoryInfo …