private async Task<IList<string>> LoadLabelsAsync(string fileName) { await using var stream = _assetLoader.GetStream(fileName); using var sr = new StreamReader(stream); var labels = (await sr.ReadToEndAsync()) .Split('\n', StringSplitOptions.RemoveEmptyEntries) .Select(s => s.Trim()) .Where(s => !string.IsNullOrEmpty(s)) .ToList(); return labels; }
private async Task <IList <string> > LoadLabels(string fileName) { using (var stream = _assetLoader.GetStream(fileName)) using (var sr = new StreamReader(stream)) { var content = await sr.ReadToEndAsync(); var labels = content.Split( new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); //for (var i = 0; i < labels.Length; i++) //{ // labels[i] = labels[i].TrimEnd('\r'); //} return(labels); } }