using System.Collections.Generic; using System.Linq; namespace CapnpC.CSharp.Generator.Model { interface IHasNestedDefinitions { IEnumerable NestedTypes { get; } ICollection NestedDefinitions { get; } ICollection Constants { get; } } static partial class Extensions { public static IEnumerable GetNestedTypes(this IHasNestedDefinitions def) => def.NestedDefinitions.Select(d => d as TypeDefinition).Where(d => d != null); } }