microsoft/teams.net

Public

mirrored fromhttps://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
fix/msal-cache

Branches

Tags

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

Clone

HTTPS

Download ZIP

Libraries/Microsoft.Teams.AI/FunctionCollection.cs

42lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4namespace Microsoft.Teams.AI;
5
6/// <summary>
7/// a collection of functions
8/// </summary>
9[Obsolete("Microsoft.Teams.AI is deprecated and will be removed by end of summer 2026.")]
10public class FunctionCollection : Dictionary<string, IFunction>
11{
12 /// <summary>
13 /// the names of the functions in
14 /// the collection
15 /// </summary>
16 public IList<string> Names => Keys.ToList();
17
18 /// <summary>
19 /// the functions in the collection
20 /// as a list
21 /// </summary>
22 public IList<IFunction> List => Values.ToList();
23
24 /// <summary>
25 /// check if the collection contains
26 /// some function name
27 /// </summary>
28 /// <param name="name">the function name</param>
29 public bool Has(string name) => ContainsKey(name);
30
31 /// <summary>
32 /// get a function
33 /// </summary>
34 /// <param name="name">the function name</param>
35 public IFunction? Get(string name) => !Has(name) ? null : this[name];
36
37 /// <summary>
38 /// add a function
39 /// </summary>
40 /// <param name="function">the function to add</param>
41 public void Add(IFunction function) => this[function.Name] = function;
42}