C # - access to elements of a collection inherited from List <string>
I am trying to implement a new class inherited from List<string>to load contents from a text file into elements.
using System.Collections.Generic;
using System.IO;
using System.Linq;
public class ListExt : List<string>
{
string baseDirectory;
public void LoadFromFile(string FileName)
{
//does not work because _list is private
this._items = File.ReadAllLines(FileName).ToList();
}
}
But I do not know how to load strings into a property _items, because it is personal.
Any suggestions?
+3