Table of Contents

Method GetNames

Namespace
LMKit.Agents
Assembly
LM-Kit.NET.dll

GetNames()

Gets a snapshot of all registered agent names.

public IReadOnlyCollection<string> GetNames()

Returns

IReadOnlyCollection<string>

A new read-only collection containing the names of all registered agents at the time of the call.

Examples

Example: Creating a snapshot for safe iteration

using LMKit.Agents;

var registry = new AgentRegistry(); // ... agents registered ...

// Get a snapshot of names var nameSnapshot = registry.GetNames();

// Safe to modify registry during iteration foreach (string name in nameSnapshot) { if (name.StartsWith("temp_")) { registry.Remove(name); Console.WriteLine($"Removed temporary agent: {name}"); } }

Remarks

Unlike the Names property, this method returns a snapshot that is not affected by subsequent modifications to the registry. Use this when you need a stable list of names for iteration while potentially modifying the registry.

Share