# Virtualization

## Content



Data Virtualization enables hassle-free loading of large amount of data in lesser period of time. It enables the List to download only the required screen-display information instead of the whole data.

The following GIF shows how data virtualization makes it convenient to render a large amount of data in List.

![data virtualization](https://cdn.mescius.io/document-site-files/images/1e4aa2c8-7f81-4e43-8ed4-f673f1e68381/images/virtualization.gif)

List supports virtualization of data to fetch the list of items as the user scrolls in real time. This data virtualization technique is supported in the List through **DataCollection** which provides **C1VirtualDataCollection** class for data virtualized collection views.

To enable virtualization in List, follow these steps:

1.  Define a virtual collection view for by using C1VirtualDataCollection class as shown in the following code. The following code uses the **GetPageAsync** method to fetch data from the **Product** class defined in the [Quick Start](/componentone/docs/win/online-list/listforwinformsquick) topic.
    
    ```csharp
    public class VirtualModeCollectionView : C1VirtualDataCollection<Customer>
        {
            public int TotalCount { get; set; } = 1_000;
            protected override async Task<Tuple<int, IReadOnlyList<Product>>> GetPageAsync(int pageIndex, int startingIndex, int count, IReadOnlyList<SortDescription> sortDescriptions = null, FilterExpression filterExpression = null, CancellationToken cancellationToken = default(CancellationToken))
            {
                await Task.Delay(500, cancellationToken);//Simulates network traffic.
                return new Tuple<int, IReadOnlyList<Product>>(TotalCount, Enumerable.Range(startingIndex, count).Select(i => new Product(i)).ToList());
            }
        }
    ```
    
2.  Bind the virtual collection object with the control using <span data-popup-content="This property is available in \u003ca href=\u0022/componentone/docs/win/online-list/\u0022\u003e.NET\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-list/\u0022\u003e.NET Framework\u003c/a\u003e." data-popup-title="DataSource" data-popup-theme="ui-tooltip-green qtip-green">DataSource</span> property of the <span data-popup-content="This class is available in \u003ca href=\u0022/componentone/docs/win/online-list/\u0022\u003e.NET\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-list/\u0022\u003e.NET Framework\u003c/a\u003e." data-popup-title="C1List" data-popup-theme="ui-tooltip-green qtip-green">C1List</span> class.
    
    ```csharp
    //begins updating
    c1List1.BeginUpdate();
    var collectionView = new VirtualModeCollectionView();
    //sets the view
    c1List1.DataSource = new C1DataCollectionBindingList(collectionView);
    c1List1.EndUpdate();
    ```