ToDictionary
ToDictionary
Namespace
Summary== Sends the properties/values of an object to a Dictionary . ==Example==Dictionary<string,object> objectValues=myObject.ToDictionary(); ==Unit Test
public void ToDictionaryShouldReturn5ItemsForTest_Object() { var tester = new { thing1 = "test", thing2 = DateTime.Now, thing3 = 1, thing4 = 2.03M, thing5 = Guid.NewGuid() }; var result = tester.ToDictionary(); Assert.Equal(5, result.Count); }
Comments
SubSonic 3.0 implements this as an extension method - 2.x uses a static method on SubSonic.Sugar.Numeric.