/// Loads custom attributes of the specified type for the given resource.
/// </summary>
/// <typeparam name="T">The type, or a base type, of the custom attributes to load.</typeparam>
/// <param name="resource">The resource for which to load custom attributes of type <typeparamref name="T"/>.</param>
/// <param name="inherit"><c>True</c> to include custom attributes of type <typeparamref name="T"/> defined for ancestors of <paramref name="resource"/>, <c>false</c> otherwise.</param>
/// <returns>An array of custom attributes of type <typeparamref name="T"/>.</returns>.
/// <remarks>
/// This method is performance-critical. Overrides must not invoke script engine methods or
/// other ClearScript functionality. The base implementation loads custom attributes via