ObjectExtensions ParseAnonymousObject Method The WebApiClient Documentation
Converts an anonymous type into a dictionary

Namespace: WebApiRestService
Assembly: WebApiClient (in WebApiClient.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static IDictionary<string, Object> ParseAnonymousObject(
	this Object obj
)

Parameters

obj
Type: System Object
The object to be transformed

Return Value

Type: IDictionary String, Object 
A dictionary of KeyValuePairs

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Object. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Examples
var x = new { id = 1, name = "foo", lastName = "bar" };

IDictionary{string, object} values = x.ParseAnonymousObject();

foreach (var item in values)
{
    Console.WriteLine(string.Format("{0}={1}", item.Key, item.Value));
}
See Also