.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Collections.Generic;
using System.Dynamic;
					
public class Program
{
	public static void Main()
	{		
       dynamic obj = new ExpandoObject();
       obj.Product = "Pie";
       obj.Quantity = 2;
       
	   foreach(var prop in (IDictionary<string, object>)obj)
	   {
		 Console.WriteLine(prop.Key + " : " + prop.Value);
	   }
	}
}
;