Possible Duplicate:
LINQ: Select parsed int, if string was parseable to int
This could be a basic question, but I couldn't figure out a work around. I have an array of strings and I tried to parse them with integers. As expected I got Format Exception.
How could I skip "3a" and proceed parsing the remaining array and storing the integers into output using Linq.? Is this a better approach or a DON'T DO practice? Pls shed some light on how to use TryParse in this case
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] values = { "1", "2", "3a","4" };
            List<int> output = new List<int>();
            try{
                output = values.Select(i => int.Parse(i)).ToList<int>();
            }
            catch(FormatException)
            {
                foreach (int i in output)
                    Console.WriteLine(i);
            }
            foreach (int i in output)
                Console.WriteLine(i);
            Console.ReadLine();
        }
    }
}