todictionary c# code example Example: function toDictionary var propertyDictionary = object.ToDictionary(x => x.Property1, x => x.Property2);