"Embedded Client Stream API"

public class EmbeddedClientStream {
	public const int MaxMessageLength = 100;

    public void SendMessage(string message) {
		// TODO truncate to 100 bytes max after encoding and send message

		Console.WriteLine($"Sent message: \"{message}\" ({Encoding.UTF8.GetBytes(message).Length} bytes UTF8)");
	}

    public void SendMessage(EmbeddedClientStreamInterpolatedStringHandler interpolatedStringHandler) {
        SendMessage(interpolatedStringHandler.GetFormattedText());
	}
}


Code snippet taken from "Two Decades of C#: A Reference - C# 10".