Rob's Blog
Stuff. You know. Just stuff.

Archive for the ‘Programming’ Category

Using XmlSerializer with implicit operators instead of TypeConverter or IValueConverter

October 2, 2012

The XmlSerializer class does not understand either TypeConverter or IValueConverter. However it is still possible to perform custom type conversion on types where it is possible to set up implicit operators. Create your custom type. Add an implicit converter to and from a string. When the type is used decorate with [XmlElement(typeof(string)] to force transition […]

Power Sets in C#

September 11, 2012

Power Sets in C# These are my implementations. 1. Using binary arithmatic. using System.Collections.Generic; namespace PowerSets {   class Solution1   {     public static IList<IList<T>> PowerSet<T>(IList<T> list)     {       int n = 1 << list.Count; IList<IList<T>> powerset = new List<IList<T>>(); for (int i = 0; i < n; ++i) […]

Design a site like this with WordPress.com
Get started