Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace Padroes
- {
- class Program
- {
- static void Main(string[] args)
- {
- try
- {
- // Open the text file using a stream reader.
- const string FILENAME = @"Example.txt";
- List<List<int>> data = new List<List<int>>();
- string inputLine = "";
- StreamReader reader = new StreamReader(FILENAME);
- while ((inputLine = reader.ReadLine()) != null)
- {
- inputLine = inputLine.Trim();
- if (inputLine.Length > 0)
- {
- List<int> inputArray = inputLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
- data.Add(inputArray);
- Console.WriteLine(inputLine);
- }
- }
- }
- catch (Exception e)
- {
- Console.WriteLine("The file could not be read:");
- Console.WriteLine(e.Message);
- }
- Console.ReadKey();
- }
- }
- }
- 1 2 9
- 1 2 9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement