Use TextBuilder instead of Text for assignment in loops #721
christophstuber
started this conversation in
New Rule
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This pattern of appending to texts in loops is very common in BC, especially for building filters:
However, because the Text type is implemented as System.String by the runtime, each assignment creates a new string in memory, which can lead to very poor performance.
Microsoft mentions this in the official documentation https://learn.microsoft.com/de-de/dynamics365/business-central/dev-itpro/developer/methods-auto/textbuilder/textbuilder-data-type#remarks
Beta Was this translation helpful? Give feedback.
All reactions