mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
* Renaming Microsoft.Agent.Workflows to Microsoft.Agents.AI.Workflows * Removing local settings. * Removing remining old files from merge.
28 lines
726 B
C#
28 lines
726 B
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using Microsoft.Shared.Diagnostics;
|
|
|
|
namespace Microsoft.Agents.AI.Workflows.Execution;
|
|
|
|
internal sealed class StateUpdate
|
|
{
|
|
public string Key { get; }
|
|
public object? Value { get; }
|
|
public bool IsDelete { get; }
|
|
|
|
private StateUpdate(string key, object? value, bool isDelete = false)
|
|
{
|
|
this.Key = Throw.IfNullOrEmpty(key);
|
|
this.Value = value;
|
|
this.IsDelete = isDelete;
|
|
}
|
|
|
|
public static StateUpdate Update<T>(string key, T? value) => new(key, value, value is null);
|
|
|
|
public static StateUpdate Delete(string key)
|
|
{
|
|
Throw.IfNullOrEmpty(key);
|
|
return new StateUpdate(key, null, isDelete: true);
|
|
}
|
|
}
|