Extends System.Collections.Generic.Dictionary<string, object>
Implements IPhpObject
This is also the default return type for deserialized objects.
Aside from the GetClassName()
and SetClassName()
implementations for the IPhpObject interface, this class behaves exactly like any other Dictionary.
Like the PhpDynamicObject, it can also be used to create arbitrary PHP Objects for serialization:
var objectDictionary = new PhpObjectDictionary();
objectDictionary.Add("firstname", "Joseph");
objectDictionary.Add("lastname", "Bishop");
objectDictionary.SetClassName("Person");
PhpSerialization.Serialize(myObject);
// O:6:"Person":2:{s:9:"firstname";s:6:"Joseph";s:8:"lastname";s:6:"Bishop";}
Important:
PhpObjectDictionary
only supports string keys. You can not deserialize PHP objects with integer keys using this type. This may be addressed in future releases.