Есть текстовый файл с данными формата string, string. Записанный в текстовый файл вида: [2019-12-23 21:00:00Z , 1] Запятая разделитель. Перевод данных из файла в коллекцию идет по алгоритму:
var assembly =
IntrospectionExtensions.GetTypeInfo(typeof(MainPage)).Assembly;
Stream stream =
assembly.GetManifestResourceStream("App255555.myfile.txt");
string text = "";
using (var reader = new System.IO.StreamReader(stream))
{
string line = null;
// while it reads a key
while ((line = reader.ReadLine()) != null)
{
// add the key and whatever it
// can read next as the value
Dict2020.year2020Dict.Add(line, reader.ReadLine());
}
//text = reader.ReadToEnd();
}
Файл читается. Но при проверке значений в коллекции, пишет, что там нет значений.
ListView lv = new ListView();
lv.ItemsSource = Dict2020.year2020Dict.Keys;
string hhh = "2019-12-22 21:00:00Z";
text = Dict2020.year2020Dict[hhh];
Label label = new Label
{
VerticalTextAlignment = TextAlignment.Center,
HorizontalTextAlignment = TextAlignment.Center,
Text = text,
FontSize = Device.GetNamedSize(NamedSize.Large,
typeof(Label))
};
Content = label;
Буду благодарен любой помощи.