Class XmlSerializerCache
Summary description for XmlSerializerCache.
Inheritance
Implements
Namespace: ImageVault.Common.Lib.Xml.Serialization
Assembly: ImageVault.Common.dll
Syntax
public class XmlSerializerCache : Object
Constructors
XmlSerializerCache(Object, Boolean)
Creates an instance of the XmlSerializerCache class.
Declaration
public XmlSerializerCache(object startItem, bool forSerialization)
Parameters
Type | Name | Description |
---|---|---|
System.Object | startItem | The object that started the serialization |
System.Boolean | forSerialization | If the cache is for serialization or deserialization. |
Properties
StartItem
Gets the StartItem of the XmlSerializerCache
Declaration
public object StartItem { get; }
Property Value
Type | Description |
---|---|
System.Object |
Methods
Add(Object)
Adds an object to the cache.
Declaration
public int Add(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The System.Object to add |
Returns
Type | Description |
---|---|
System.Int32 | The id of the object that was added. |
Dispose()
Releases all resources used by the object.
Declaration
public void Dispose()
Remarks
Calling Dispose allows the resources used by the object to be reallocated for other purposes. For more information about Dispose, see Cleaning Up Unmanaged Resources.
Dispose(Boolean)
Releases the unmanaged resources used by the object and optionally releases the managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Remarks
This method is called by the public Dispose() method and the Finalize method. Dispose() invokes the protected Dispose(Boolean) method with the disposing parameter set to true. Finalize invokes Dispose with disposing set to false. When the disposing parameter is true, this method releases all resources held by any managed objects that this object references. This method invokes the Dispose() method of each referenced object. Notes to Inheritors: Dispose can be called multiple times by other objects. When overriding Dispose(Boolean), be careful not to reference objects that have been previously disposed of in an earlier call to Dispose. For more information about how to implement Dispose(Boolean), see Implementing a Dispose Method. For more information about Dispose and Finalize, see Cleaning Up Unmanaged Resources and Overriding the Finalize Method.
EnsureInCache(Object, out Int32)
Ensures that the supplied item is contained in the cache.
Declaration
public bool EnsureInCache(object o, out int id)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The System.Object to check/add. |
System.Int32 | id | The id that the object has in the cache. |
Returns
Type | Description |
---|---|
System.Boolean | True if the object already existed in the cache, false if it was added. |
Exceptions
Type | Condition |
---|---|
System.ApplicationException | If the cache is created for serialization |
Finalize()
Releases unmanaged resources and performs other cleanup operations before the XmlSerializerCache is reclaimed by garbage collection.
Declaration
protected override void Finalize()
GetId(Object)
Gets the associated id of the object
Declaration
public int GetId(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The System.Object to get the id for |
Returns
Type | Description |
---|---|
System.Int32 | The found id |
Exceptions
Type | Condition |
---|---|
System.ApplicationException | If the cache is created for deserialization |
System.ApplicationException | If the object wasn't found in the cache |
GetObject(Int32)
Gets an object from the cache with the supplied id.
Declaration
public object GetObject(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The id of the object |
Returns
Type | Description |
---|---|
System.Object | The found object |
Exceptions
Type | Condition |
---|---|
System.ApplicationException | If the cache is created for serialization |
System.ApplicationException | If the object wasn't found in the cache |