in src/Google.Cloud.Functions.Hosting/FunctionsStartupAttribute.cs [49:70]
public FunctionsStartupAttribute(Type startupType) =>
StartupType = startupType;
/// <summary>
/// Returns the functions startup classes found in the attributes of <paramref name="assembly"/> and
/// <paramref name="target"/>, ordered by <see cref="Order"/> and then by the full name of the type.
/// </summary>
/// <param name="assembly">The assembly to inspect for attributes.</param>
/// <param name="target">Optional type to query for attributes. If this is null, only
/// startup classes from <paramref name="assembly"/> are returned.
/// </param>
/// <returns>A (possibly empty) sequence of the startup types detected via attributes.</returns>
public static IEnumerable<Type> GetStartupTypes(Assembly assembly, Type? target)
{
var fromAssembly = assembly.GetCustomAttributes<FunctionsStartupAttribute>();
var fromType = target?.GetCustomAttributes<FunctionsStartupAttribute>(inherit: true) ?? Enumerable.Empty<FunctionsStartupAttribute>();
return fromAssembly.Concat(fromType)
.OrderBy(attr => attr.Order)
.ThenBy(attr => attr.StartupType.FullName)
.Select(attr => attr.StartupType)
.ToList();
}