C/AL vs. C# i Dynamics NAV

In Dynamics NAV we write our code in C/AL, and this has been that way for ever. But NAV now runs on .NET and how does that work.

Well the truth is that C/AL is only there for the NAV programmer, and is NOT used in running NAV. Its only used in the Development Environment.
WHAT, not use in NAV….

C/AL is on compilation transformed into C# (csharp), and it is this code that runs on the server. This happens in the Object Metadata table. Lets have a look.

All object have a record in the Object Metadata table.
In the Metadata field we have table layout in XML.
In the “User AL Code” field we have all the C/AL code.
And in the “User Code” field we have the translated C# code that is used to run NAV.

Want to see the code, easy.


// Export the C# code for Codeunit 80
ObjectMetaData.GET(ObjectMetaData."Object Type"::Codeunit, 80);
ObjectMetaData.CALCFIELDS("User Code", "User Code");
ObjectMetaData."User Code".CREATEINSTREAM(CodeInStream);
COPYSTREAM(CodeOutStream, CodeInStream);


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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s