using System.Collections.Generic;
public static void Main()
List<long ? > result = null;
if (!string.IsNullOrEmpty(baIds))
result = baIds.Split(',').Select(e => long.TryParse(e, out temp) ? temp : (long ? )null).ToList();
foreach (long ? item in result)
Console.WriteLine(item.HasValue ? item.ToString() : "null");