The in-memory exporter stores data in a user provided memory buffer.
dotnet add package OpenTelemetry.Exporter.InMemory
var list = new List<object>();
var activityExporter = new InMemoryExporter<Activity>(
new InMemoryExporterOptions { ExportedItems = list });
var logExporter = new InMemoryExporter<LogRecord>(
new InMemoryExporterOptions { ExportedItems = list });