1

私はこのリンクを読みました:

http://www.codeproject.com/Articles/34405/WPF-Data-Virtualization

データ仮想化を使用してテキスト ファイルを読み取るには:

DemoCustomerProvider.cs で、次のように変更しました。

 for( int i=startIndex; i<startIndex+count; i++ )
        {
            Customer customer = new Customer { Id = i + 1, Name = "Customer" + (i+1) };
            list.Add(customer);

        }

に :

  for( int i=startIndex; i<startIndex+count; i++ )
        {
            using (StreamReader str = new StreamReader("C:\\test.txt"))
            {
                while (str.ReadLine() != null)
                {
                    string data=str.ReadLine();
                    Customer customer = new Customer { Id = i + 1, Name =data }   
                    list.Add(customer);

                }
            }
           }

テキストのサイズは 2 MB ですが、Data Virtualization を開始すると、3 GB のメモリを使用します。

データ仮想化を使用してテキスト ファイルを読み取る方法を知りたいですか?

4

1 に答える 1