there's also a WONDERFUL, OUTSTANDING session by vjekoslav babic, done at the navtechdays that explains a lot of things (array and CAL/.NET datatype mapping included).
you can download it here http://www.mibuso.com/dlinfo.asp?FileID=1399
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
Thanks for your replies. After looking at the video ( great by the way ) I figured out how to do it. I used the wrapper.
Sorry that Microsoft hasn't provided us with these wrappers in NAV... In my opinion, one great thing about the Dotnet interop is that you don't have to distribute a lot of dll:s. But to handle this, you have to distribute the wrapper...
NOTE: NETConvert was another DotNet variable for Encoding.
NETArray is now your byte array and you can write to it. The only downfall I've found is the fact that you have to create an instance knowing the length up front. So for me I had to 'getbytes' twice...but at least it keeps everything in C/AL.
Comments
EDIT:
But since System.Byte is mapped to the C/AL Datatype Char you could make a char array of the size you need and use that one? (Not tested)
http://msdn.microsoft.com/en-us/library/gg502522.aspx
you can download it here
http://www.mibuso.com/dlinfo.asp?FileID=1399
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Thanks for your replies. After looking at the video ( great by the way ) I figured out how to do it. I used the wrapper.
Sorry that Microsoft hasn't provided us with these wrappers in NAV... In my opinion, one great thing about the Dotnet interop is that you don't have to distribute a lot of dll:s. But to handle this, you have to distribute the wrapper...
Br, Jonas
Two Variables:
Name DataType Subtype
NETArray DotNet System.Array.'mscorlib, Version=4.0.0.0, Culture=neutral,...
NETType DotNet System.Type.'mscorlib, Version=4.0.0.0, Culture=neutral,...
In C/AL:
NETType := NETType.GetType('System.Byte',FALSE);
NETArray := NETArray.CreateInstance(NETType, NETConvert.FromBase64String(BigString).Length);
NOTE: NETConvert was another DotNet variable for Encoding.
NETArray is now your byte array and you can write to it. The only downfall I've found is the fact that you have to create an instance knowing the length up front. So for me I had to 'getbytes' twice...but at least it keeps everything in C/AL.