Repository: microsoft/semantic-kernel
File: dotnet/samples/Concepts/Agents/ChatCompletion_Whiteboard.cs (C#)

Code before:

        // Invoke the agent.
        ChatMessageContent response = await agent.InvokeAsync(message, agentThread).FirstAsync();

        // Print the response.
        Console.WriteLine($"Assistant:\n{response.Content}\n");

        // Make sure any async whiteboard processing is complete before we print out its contents.
        await whiteboardBehavior.WhenProcessingCompleteAsync();

        // Print out the whiteboard contents.
        Console.WriteLine("Whiteboard contents:");
        foreach (var item in whiteboardBehavior.CurrentWhiteboardContent)
        {
            Console.WriteLine($"- {item}");
        }
        Console.WriteLine();

        // Truncate the chat history if it gets too big.
        await agentThread.ChatHistory.ReduceInPlaceAsync(chatHistoryReducer, CancellationToken.None);
    }

    private sealed class VMPlugin
    {
        [KernelFunction]
        public Task<VMCreateResult> CreateVM(Region region, OperatingSystem os, string name, int numberOfCores, int memorySizeInGB, int HddSizeInGB)
        {
            if (name == "ContosoVM")
            {
                throw new Exception("VM name already exists");
            }

            return Task.FromResult(new VMCreateResult { VMId = Guid.NewGuid().ToString() });
        }
    }

    public class VMCreateResult
    {
        public string VMId { get; set; } = string.Empty;
    }

    private enum Region
    {
        NorthAmerica,
        SouthAmerica,
        Europe,
        Asia,
        Africa,
        Australia
    }


Review comment (suggestion):
```suggestion
        public Task<VMCreateResult> CreateVM(Region region, OperatingSystem os, string name, int numberOfCores, int memorySizeInGB, int hddSizeInGB)
```

Code after:

        // Invoke the agent.
        ChatMessageContent response = await agent.InvokeAsync(message, agentThread).FirstAsync();

        // Print the response.
        Console.WriteLine($"Assistant:\n{response.Content}\n");

        // Make sure any async whiteboard processing is complete before we print out its contents.
        await whiteboardBehavior.WhenProcessingCompleteAsync();

        // Print out the whiteboard contents.
        Console.WriteLine("Whiteboard contents:");
        foreach (var item in whiteboardBehavior.CurrentWhiteboardContent)
        {
            Console.WriteLine($"- {item}");
        }
        Console.WriteLine();

        // Truncate the chat history if it gets too big.
        await agentThread.ChatHistory.ReduceInPlaceAsync(chatHistoryReducer, CancellationToken.None);
    }

    private sealed class VMPlugin
    {
        [KernelFunction]
        public Task<VMCreateResult> CreateVM(Region region, OperatingSystem os, string name, int numberOfCores, int memorySizeInGB, int hddSizeInGB)
        {
            if (name == "ContosoVM")
            {
                throw new Exception("VM name already exists");
            }

            return Task.FromResult(new VMCreateResult { VMId = Guid.NewGuid().ToString() });
        }
    }

    public class VMCreateResult
    {
        public string VMId { get; set; } = string.Empty;
    }

    private enum Region
    {
        NorthAmerica,
        SouthAmerica,
        Europe,
        Asia,
        Africa,
        Australia
    }