C# - Accesing to items for a collection inherited from List<string>
- by Salvador
I am trying to implement a new class inherited from List<string>, 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>
{
string baseDirectory;
public LoadFromFile(string FileName)
{
this._items = File.ReadAllLines(FileName).ToList();//does not work because _list is private
}
}
but i dont knew how to load the lines into the _items property because is private.
any suggestions?