0
(Type, int)[] Format1 = new[] {(typeof(Foo),1)};

(Type, int)[] Format2 = new[] { (typeof(Bar), 1),(typeof(Baz),1) };

IEnumerable<Type> allTypes() => //Foo,Bar,Baz

Can you help with:

  1. how to temporarily union Format1 and Format2 in a quick way, so that...
  2. we can extract the types out of the tuples and return them in allTypes()
NWoodsman
  • 423
  • 4
  • 10

1 Answers1

1
IEnumerable<Type> allTypes() => Format1
    .Select(t => t.Item1)
    .Union(Format2.Select(t => t.Item1));

Union removes duplicates as desired, otherwise use Concat.

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939