# XML Serialization

## Content

Serialization refers to converting an object into a stream of bytes. The purpose of serialization is to save the current state of an object so that it can be recreated when required. DashboardLayout supports serialization through <span data-popup-content="This class is available in both \u003ca href=\u0022/componentone/docs/win/online-dashboardlayout/\u0022\u003e.NET\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-dashboardlayout/\u0022\u003e.NET Framework\u003c/a\u003e assemblies." data-popup-title="SaveLayout" data-popup-theme="ui-tooltip-green qtip-green">SaveLayout</span> and <span data-popup-content="This class is available in both \u003ca href=\u0022/componentone/docs/win/online-dashboardlayout/\u0022\u003e.NET\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-dashboardlayout/\u0022\u003e.NET Framework\u003c/a\u003e assemblies." data-popup-title="LoadLayout" data-popup-theme="ui-tooltip-green qtip-green">LoadLayout</span> methods of the <span data-popup-content="This class is available in both \u003ca href=\u0022/componentone/docs/win/online-dashboardlayout/\u0022\u003e.NET\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-dashboardlayout/\u0022\u003e.NET Framework\u003c/a\u003e assemblies." data-popup-title="C1DashboardLayout" data-popup-theme="ui-tooltip-green qtip-green">C1DashboardLayout</span> class. The **SaveLayout** method saves the DashboardLayout layout properties, i.e., order and bounds of child containers, to an XML stream or file. The **LoadLayout** method loads the DashboardLayout layout properties from an XML stream or file.

The following code shows the example of saving and loading the DashboardLayout to and from an XML file:

```csharp
c1DashboardLayout1.SaveLayout(“DashboardLayout.xml");
c1DashboardLayout1.LoadLayout(“DashboardLayout.xml");
```

```vbnet
c1DashboardLayout1.SaveLayout(“DashboardLay.xml")
c1DashboardLayout1.LoadLayout(“DashboardLay.xml")
```

The following code shows example of saving and loading the DashboardLayout to and from an XML stream:

```csharp
MemoryStream  stream = new MemoryStream();
c1DashboardLayout1.SaveLayout(stream);
stream.Seek(0, SeekOrigin.Begin);
c1DashboardLayout1.LoadLayout(stream);
```

```vbnet
Dim stream As MemoryStream =  New MemoryStream() 
c1DashboardLayout1.SaveLayout(stream)
stream.Seek(0, SeekOrigin.Begin)
c1DashboardLayout1.LoadLayout(stream)
```