BotSharp/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/ConversationState.cs

23 lines
474 B
C#
Raw Normal View History

2023-08-09 21:49:55 +00:00
namespace BotSharp.Abstraction.Conversations.Models;
public class ConversationState : Dictionary<string, string>
{
2023-09-03 22:43:50 +00:00
public ConversationState()
{
}
2023-09-09 21:44:25 +00:00
public ConversationState(List<StateKeyValue> pairs)
2023-09-03 22:43:50 +00:00
{
foreach (var pair in pairs)
{
this[pair.Key] = pair.Value;
}
}
2023-09-08 17:17:54 +00:00
2023-09-09 21:44:25 +00:00
public List<StateKeyValue> ToKeyValueList()
2023-09-08 17:17:54 +00:00
{
2023-09-09 21:44:25 +00:00
return this.Select(x => new StateKeyValue(x.Key, x.Value)).ToList();
2023-09-08 17:17:54 +00:00
}
2023-08-09 21:49:55 +00:00
}