Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
This article describes performance insights when using Format or string interpolation ($"...").
Cause
Using string.Format or string interpolation frequently results in slow performance.
Performance insight description
Each call to string.Format or string interpolation creates a new string object, resulting in excessive memory allocations and CPU usage when used repeatedly, especially in loops or performance-critical code paths.
If possible, use a StringBuilder for repeated string manipulations, or cache formatted strings when possible. StringBuilder allows for efficient string construction without creating multiple intermediate string objects.
How to investigate a warning
In the CPU Usage tool, click View source code to find where string.Format or string interpolation is used excessively. If possible, refactor to use StringBuilder or minimize formatting operations in hot paths.