How to convert type int[] to int?[]
I'm using a linq query to output an int array. But I need to pass this into a method that only accepts int?[]. So after searching on ways to convert int[] to int?[] I found something that seemed might work here The following code is a simplified example that shows what is working and not working. using System; using System.Collections.Generic; using System.Web; using System.Linq; namespace ConsoleApp { class Program { static void Main(string[] args) { // working... int[] vids1 = new[] { "", "1", "2", "3" } .Where(x => !String.IsNullOrWhiteSpace(x)) .Select(x => Convert.ToInt32(x)) .ToArray();