using System; using System.Collections.Generic; using System.Text; namespace Persistence { class TestClass { [AutoStorable(Name="TestProperty", DefaultValue=12)] public object o; [AutoStorable] public int x = 2; public int y; } class AttributeTest { static void Main() { TestClass t = new TestClass(); Dictionary accessors = AutoStorableAttribute.GetAutostorableAccessors(t); foreach ( KeyValuePair pair in accessors ) { Console.WriteLine(pair.Key + ": " + pair.Value.ToString()); } t.o = new Object(); t.x = 12; t.y = 312890; accessors["o"].Set(null); accessors["x"].Set(123); try { accessors["y"].Set(0); throw new InvalidOperationException(); } catch ( KeyNotFoundException ) { } Console.ReadLine(); } } }