# XML Serialization

Learn how use XML serialization and deserialization in C1DataFilter control.

## Content

The DataFilter control supports serialization through <span data-popup-content="This property is available in both \u003ca href=\u0022/componentone/docs/win/online-datafilter/\u0022\u003e.NET Framework\u003c/a\u003e and .\u003ca href=\u0022/componentone/docs/win/online-datafilter/\u0022\u003eNET\u003c/a\u003e." data-popup-title="SaveFilterExpression" data-popup-theme="ui-tooltip-green qtip-green">SaveFilterExpression</span> and <span data-popup-content="This property is available in both \u003ca href=\u0022/componentone/docs/win/online-datafilter/\u0022\u003e.NET Framework\u003c/a\u003e and .\u003ca href=\u0022/componentone/docs/win/online-datafilter/\u0022\u003eNET\u003c/a\u003e." data-popup-title="LoadFilterExpression" data-popup-theme="ui-tooltip-green qtip-green">LoadFilterExpression</span> methods of the <span data-popup-content="This class is available in both \u003ca href=\u0022/componentone/docs/win/online-datafilter/\u0022\u003e.NET Framework\u003c/a\u003e and .\u003ca href=\u0022/componentone/docs/win/online-datafilter/\u0022\u003eNET\u003c/a\u003e." data-popup-title="C1DataFilter" data-popup-theme="ui-tooltip-green qtip-green">C1DataFilter</span> class. The **SaveFilterExpression** method saves the current filter expressions from C1.Win.DataFilter.C1DataFilter.Filters collection to an XML file. The **LoadFilterExpression** method loads the saved filter expressions from an XML file.

The following GIF demonstrates serialization and deserialization support in the DataFilter control.

![Serialization](https://cdn.mescius.io/document-site-files/images/17b51e8a-8741-4303-8d01-461f0bd662e6/images/serializedeserialize.gif)

The following code shows an example of saving filter expressions to an XML file:

```vbnet
//Saves the current filter expressions to an xml file
c1DataFilter1.SaveFilterExpression("SavedFilters.xml");
MessageBox.Show("Filter state saved.");
```

```csharp
//Saves the current filter expressions to an xml file
c1DataFilter1.SaveFilterExpression("SavedFilters.xml");
MessageBox.Show("Filter state saved.");
```

The following code shows an example of loading filter expressions from an XML file:

```vbnet
'Loads the current filter expressions from an xml file
c1DataFilter1.LoadFilterExpression("SavedFilters.xml")
MessageBox.Show("Loaded saved Filter state.")
```

```csharp
//Loads the current filter expressions from an xml file
c1DataFilter1.LoadFilterExpression("SavedFilters.xml");
MessageBox.Show("Loaded saved Filter state.");
```