Break the Data Links in an Excel Workbook

Use this function to break the data links in an Excel workbook. It shows a message asking the user to confirm to break. private void BreakDataLinks(Excel._Workbook wb){ if (DialogResult.Yes ==

Encrypt a Config Section Using .NET’s Configuration Providers

var configFilePath = @”C:CodeClassifiedConfigurationsapp.config”;var sectionName = “appSettings”;EncryptConfigSection(configFilePath, sectionName);private void EncryptConfigSection(string configFilePath, string sectionName){ var configurationFileMap = new ExeConfigurationFileMap { ExeConfigFilename = configFilePath }; var configuration = ConfigurationManager.OpenMappedExeConfiguration(configurationFileMap, ConfigurationUserLevel.None); var configSection

Converting JSON Results in Camel Case

Use the CamelCasePropertyNamesContractResolver class of the Newtonsoft.Json assembly to return the JSON serialized string in camel case. var responseObject = employeeProxy.GetAllEmployees();var serializedObjectInCamelCase = JsonConvert.SerializeObject(responseObject, new JsonSerializerSettings { ContractResolver = new

Quick Way to Escape Special Characters in an XML Document

We can use the SecurityElement’s Escape method of the System.Security namespace to escape all the special characters in an XML file. Code snippet below: string escapedstring = System.Security.SecurityElement.Escape(inputXMLString); …inputXMLString ?contains