mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET: Rename workflows projects (#975)
* Renaming Microsoft.Agent.Workflows to Microsoft.Agents.AI.Workflows * Removing local settings. * Removing remining old files from merge.
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Agents.AI.Workflows;
|
||||
|
||||
/// <summary>
|
||||
/// Event triggered when a workflow executor yields output.
|
||||
/// </summary>
|
||||
public sealed class WorkflowOutputEvent : WorkflowEvent
|
||||
{
|
||||
internal WorkflowOutputEvent(object data, string sourceId) : base(data)
|
||||
{
|
||||
this.SourceId = sourceId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The unique identifier of the executor that yielded this output.
|
||||
/// </summary>
|
||||
public string SourceId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the underlying data is of the specified type or a derived type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type to compare with the type of the underlying data.</typeparam>
|
||||
/// <returns>true if the underlying data is assignable to type T; otherwise, false.</returns>
|
||||
public bool Is<T>() => this.IsType(typeof(T));
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the underlying data is of the specified type or a derived type.
|
||||
/// </summary>
|
||||
/// <param name="type">The type to compare with the type of the underlying data.</param>
|
||||
/// <returns>true if the underlying data is assignable to type T; otherwise, false.</returns>
|
||||
public bool IsType(Type type) => this.Data == null
|
||||
? false
|
||||
: type.IsAssignableFrom(this.Data.GetType());
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to retrieve the underlying data as the specified type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type to which to cast.</typeparam>
|
||||
/// <returns>The value of Data as to the target type.</returns>
|
||||
public T? As<T>() => this.Data is T value ? value : default;
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to retrieve the underlying data as the specified type.
|
||||
/// </summary>
|
||||
/// <param name="type">The type to which to cast.</param>
|
||||
/// <returns>The value of Data as to the target type.</returns>
|
||||
public object? AsType(Type type) => this.IsType(type) ? this.Data : null;
|
||||
}
|
||||
Reference in New Issue
Block a user