Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const string formatString = "yyyyMMdd HHmmss";
- dtos = File.ReadAllLines(fileName.FullName)
- .Skip(1)
- .Select(line => new {line, columns = line.Split(';')})
- .Select(t =>
- {
- try
- {
- return new Foo
- {
- Bar = DateTime.ParseExact(t.columns[0], formatString, CultureInfo.InvariantCulture, DateTimeStyles.None)
- };
- }
- catch (FormatException)
- {
- Console.WriteLine("{0} is not in the correct format.", t.columns[0])
- }
Add Comment
Please, Sign In to add comment