Append String – Use DotNet Variable

 

Hey Everybody,

As a Developer there many scenario comes up where we need to append a text value. This kind of needs do comes up when we need to maintain a certain string length. As a common NAV Developer we use to write the below piece of code.

Capture

Replacing the above piece of code with some DotNet variable will literally make you shock as far as the Performance  & Optimization is concerned. Have a look on the below code.

Capture1

If you will calculate the Time taken by the above piece of codes then you will find that the second is 5 to 10 times faster then the first one. For e.g if First one takes 49 Sec 256 Milliseconds then the Second one will take just around 20 Milliseconds.

StringBuilder – DotNet – System.Text.StringBuilder.’mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′

Advertisements