# C＃ - 訪問從List <string>繼承的集合的項目

I am trying to implement a new class inherited from List, to load the contents from a text file to the items.

using System.Collections.Generic;
using System.IO;
using System.Linq;

public class ListExt : List
{
string baseDirectory;

{
//does not work because _list is private
}
}


## 最佳答案

ListExt is the list - so you can just call AddRange on yourself. You can't reassign the list - that would essentially be changing this.