Load() публичный Метод

Loads the specified collection into the recent file list. Use this method when you need to initialize the RecentFileList manually. This can be useful when you are using an own persistence implementation.
Recent file items that exist before the Load method is called are removed.
The argument recentFiles must not be null.
public Load ( IEnumerable recentFiles ) : void
recentFiles IEnumerable The recent files.
Результат void
Пример #1
0
        public void Load()
        {
            RecentFileList recentFileList = new RecentFileList();
            recentFileList.MaxFilesNumber = 3;
            recentFileList.AddFile("Doc3");
            recentFileList.AddFile("Doc2");
            recentFileList.AddFile("Doc1");

            AssertHelper.ExpectedException<ArgumentNullException>(() => recentFileList.Load(null));

            // Load an empty recent file list
            recentFileList.Load(new RecentFile[] { });
            Assert.IsFalse(recentFileList.RecentFiles.Any());

            recentFileList.Load(new[] 
            {
                new RecentFile("NewDoc1") { IsPinned = true },
                new RecentFile("NewDoc2"),
                new RecentFile("NewDoc3"),
                new RecentFile("NewDoc4")
            });
            Assert.IsTrue(recentFileList.RecentFiles.Select(f => f.Path).SequenceEqual(new[] { "NewDoc1", "NewDoc2", "NewDoc3" }));
            Assert.IsTrue(recentFileList.RecentFiles.Select(f => f.IsPinned).SequenceEqual(new[] { true, false, false }));
        }