Monday, October 18, 2021

Code snippet to convert string to memory stream in Dynamics 365 finance and operations

  public static System.IO.Stream JP_generateStreamFromString(str _text)

    {

        System.Byte[]           byteArray;

        System.IO.MemoryStream  memoryStream;


        byteArray    = System.Text.Encoding::UTF8.GetBytes(_text);

        memoryStream = new System.IO.MemoryStream(byteArray);


        return memoryStream;

    }


Hope this helps!, I will come up with another interesting blog post!