Tagged with configuration

Generic method return types

Generics aren't just great for creating lists, they can also be used to return strongly typed information from a method. This example shows how to use a generic return type to parse any type of strongly typed primitive from a string.
Published in .NET on Monday, May 5th, 2008

Loading and saving registry information in C#

Saving info to the registry for the currently logged in user: RegistryKey key = Registry.CurrentUser.CreateSubKey("MyRegistryKey"); key.SetValue("MyKeyValue", "Some value"); Loading the same info from the registry: RegistryKey key = Registry.CurrentUser.CreateSubKey("MyRegistryKey"); if(key != null) { string keyValue = (string) key .GetValue("MyKeyValue"); } Reference: RegistryKey Class MSDN documentation
Published in .NET on Monday, November 8th, 2004