ModelNode node = new ModelNode(); // ... Code that uses the node node.Dispose(); // Release resources used by the node
using (ModelNode node = new ModelNode()) { // ... Code that uses the node } // Dispose called automatically at end of using blockIn this example, we create a new ModelNode object using the using statement, which automatically calls the Dispose method at the end of the block. This ensures that the object's resources are properly released even if an exception occurs. Package Library: This method is a part of the Sitecore.Kernel package library, which is a collection of core libraries that form the foundation of Sitecore CMS.