using System; using System.Linq; public class Test { public static void Main() { string[] x = { "1", "12", "10", "50", "8", null }; var test = (from max in x where !String.IsNullOrEmpty(max) select Convert.ToInt32(max)).Max(); Console.WriteLine("Max Value = " +test.ToString()); } }