microsoft/teams.net

Public

mirrored from https://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v2.0.4

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

Libraries/Microsoft.Teams.AI/FunctionCollection.cs

41lines · modeblame

82a4e3c3Rajan1 years ago1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
73e7847aAlex Acebo1 years ago4namespace Microsoft.Teams.AI;
5
6/// <summary>
7/// a collection of functions
8/// </summary>
b4ede661Alex Acebo1 years ago9public class FunctionCollection : Dictionary<string, IFunction>
73e7847aAlex Acebo1 years ago10{
11/// <summary>
12/// the names of the functions in
13/// the collection
14/// </summary>
b4ede661Alex Acebo1 years ago15public IList<string> Names => Keys.ToList();
73e7847aAlex Acebo1 years ago16
17/// <summary>
18/// the functions in the collection
19/// as a list
20/// </summary>
b4ede661Alex Acebo1 years ago21public IList<IFunction> List => Values.ToList();
73e7847aAlex Acebo1 years ago22
23/// <summary>
24/// check if the collection contains
25/// some function name
26/// </summary>
27/// <param name="name">the function name</param>
b4ede661Alex Acebo1 years ago28public bool Has(string name) => ContainsKey(name);
73e7847aAlex Acebo1 years ago29
30/// <summary>
31/// get a function
32/// </summary>
33/// <param name="name">the function name</param>
b4ede661Alex Acebo1 years ago34public IFunction? Get(string name) => !Has(name) ? null : this[name];
73e7847aAlex Acebo1 years ago35
36/// <summary>
37/// add a function
38/// </summary>
39/// <param name="function">the function to add</param>
b4ede661Alex Acebo1 years ago40public void Add(IFunction function) => this[function.Name] = function;
73e7847aAlex Acebo1 years ago41}