text: I am trying to modify a LINQ query to select some properties into an array but am struggling to achieve part of it.
  toRun.AddRange(entity.Properties
  .Select(property => property.PrimaryField)
  .Select(field => new { field, entity = entity.EntityName, table = field.Table, key = entity.EntityIdField })
  Property { PrimaryField = "a", SecondaryField = "b" },
  Property { PrimaryField = "c", SecondaryField = "" }
  { "a", "b", "c" }
  This seems to reproduce what you want: you have a class with two properties:
  public class Foo { public string Bar { get; set; } public string Baz { get; set; } }
  Of which you have a collection:
  var foos = new List<Foo> { new Foo { Bar = "a", Baz = "b" }, new Foo { Bar = "c", Baz = "" }, };
  And from this collection, you want to select all properties that have a non-empty value into an array.
  You can do so using
  SelectMany():
  var result = foos.SelectMany(f => new[] { f.Bar, f.Baz }) .Where(p => !string.IsNullOrWhiteSpace(p)) .ToArray();
  You select a new array containing the value of both properties, then filter out the values you don't want, and turn the result into an array again.