File: EmulatorResourceExtensions.cs
Web Access
Project: src\src\Aspire.Hosting\Aspire.Hosting.csproj (Aspire.Hosting)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
using Aspire.Hosting.ApplicationModel;
 
namespace Aspire.Hosting;
 
/// <summary>
/// Extension methods for managing emulator resources.
/// </summary>
public static class EmulatorResourceExtensions
{
    /// <summary>
    /// Determines whether the specified resource is an emulator resource.
    /// </summary>
    /// <param name="resource">The resource to check.</param>
    /// <returns>true if the specified resource is an emulator resource; otherwise, false.</returns>
    public static bool IsEmulator(this IResource resource)
    {
        ArgumentNullException.ThrowIfNull(resource);
 
        return resource.Annotations.OfType<EmulatorResourceAnnotation>().Any();
    }
}