top of page

Passing By Value Or By Reference In Business Central

  • Yazarın fotoğrafı: alper11 Kilic
    alper11 Kilic
  • 2 Ara 2024
  • 1 dakikada okunur

Passing By Value Or By Reference In Business Central

Hello everyone,For my first post, I want to talk about an issue I’ve come across far too often: sending parameters as variables, as shown below. But what does it mean? Why do we use var to send parameters in some cases, while in others, we don’t?




When you read microsoft’s standart code and other developers code you came across both of these parameter usage


Both of these methods are valid; however, the first one passes the Currency parameter by reference, while the second passes the JobQueueEntry parameter by value. The key difference lies in the scope of the changes.

When using var, the parameter is passed by reference, similar to pointers in C. This means any changes made to the parameter directly affect the original variable.

On the other hand, when passing by value, a copy of the record is created. Changes made to the parameter will not affect the original variable you sent.

I Hope this small post will help you to understand the passing parameters concept in Business Centeral.

 
 
 

Comments


(+90) 212 234 56 78

Büyükdere Caddesi No. 263, Sarıyer, İstanbul, Türkiye 34398

Bültenimize Abone Olun

İletişim

bottom of page