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

5 comments on “Append String – Use DotNet Variable

  1. Pingback: Append String – Use DotNet Variable - Dynamics NAV by RockWithNAV - NAV User Group

  2. Pingback: Append String – Use DotNet Variable - Microsoft Dynamics NAV Community

  3. Hey Matthias König,

    It was in seconds when I executed. :). The difference between the two is Incredible. :). Try executing with 50000 loops instead of 5000 then you will definitely feel the real difference. 🙂 The difference is up-to that level that even we cant compare the two above codes. 🙂 🙂

    Many Thanks

  4. Pingback: Append String – Use DotNet Variable | Pardaan.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s