Monday, 6 October 2025

Convert String to System.IO.Stream

 str string  = 'some string';

// Convert String to System.IO.Stream
System.Byte[]           byteArray   = System.Text.Encoding::get_UTF8().GetBytes(string);
//System.Byte[]           byteArray   = System.Text.Encoding::get_ASCII().GetBytes(string);
System.IO.MemoryStream  stream      = new System.IO.MemoryStream(byteArray);
 
// Convert Byte array to String
string = System.Text.Encoding::get_UTF8().GetString(byteArray);
//string = System.Text.Encoding::get_ASCII().GetString(byteArray);

No comments:

Post a Comment

Creating new D365FO Business Event

  The name should include the noun or phrase that corresponds with theevent, followed by the BusinessEvent suffix. New business event for Cu...