Something like this:
PROGRAM TestMemoryStream
OBJECT('ClassLibrary1.Class1') Class1
OBJECT('System.IO.MemoryStream') MemoryStream
OBJECT('System.Text.ASCIIEncoding') ASCIIEncoding
ASSEMBLY_EXTERNAL('System.Text.ASCIIEncoding.GetBytes') ASCIIEncodingGetBytes
ASSEMBLY_EXTERNAL('ClassLibrary1.Class1.ReadStream') ReadStream
ASCIIEncoding = new@('System.Text.ASCIIEncoding')
MemoryStream = new@('System.IO.MemoryStream', ASCIIEncodingGetBytes(ASCIIEncoding,'string'))
Class1 = new@('ClassLibrary1.Class1')
CALL ReadStream(Class1, MemoryStream)
END
with C# like:
namespace ClassLibrary1
{
public class Class1
{
public void ReadStream(MemoryStream memoryStream)
{
string s = '';
StreamReader streamReader = new StreamReader(memoryStream);
while ((s = streamReader.ReadLine()) != null)
{
Console.WriteLine(s);
}
}
}
}
I did have to play around to get an instance of the ASCIIEncoding class to call GetBytes with an instance of it (which wasnt clear initially). Its much the same as the previous example in many ways - just have a play creating and passing .NET objects in this way and you should get used to it.