in Win32/PropertyBag.cs [128:141]
public void Set(string name, object value)
{
CheckIfInitialized();
// In order to set a property in the property bag
// we need to convert the value to the destination type
var previousValue = Get(name);
value = Convert.ChangeType(value, previousValue==null?value.GetType() : previousValue.GetType());
// Set the property
var propbag2 = new PROPBAG2() { Name = name };
var result = nativePropertyBag.Write(1, ref propbag2, value);
result.CheckError();
propbag2.Dispose();
}