本文整理匯總了C#中MimeKit.IO.MemoryBlockStream.ToArray方法的典型用法代碼示例。如果您正苦於以下問題:C# MemoryBlockStream.ToArray方法的具體用法?C# MemoryBlockStream.ToArray怎麽用?C# MemoryBlockStream.ToArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MimeKit.IO.MemoryBlockStream
的用法示例。
在下文中一共展示了MemoryBlockStream.ToArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ImapReplayCommand
public ImapReplayCommand (string command, string resource)
{
Command = command;
using (var stream = GetType ().Assembly.GetManifestResourceStream ("UnitTests.Net.Imap.Resources." + resource)) {
var memory = new MemoryBlockStream ();
using (var filtered = new FilteredStream (memory)) {
filtered.Add (new Unix2DosFilter ());
stream.CopyTo (filtered, 4096);
}
Response = memory.ToArray ();
}
}
示例2: ReadAllBytes
static byte[] ReadAllBytes (Stream stream)
{
if (stream is MemoryBlockStream)
return ((MemoryBlockStream) stream).ToArray ();
if (stream is MemoryStream)
return ((MemoryStream) stream).ToArray ();
using (var memory = new MemoryBlockStream ()) {
stream.CopyTo (memory, 4096);
return memory.ToArray ();
}
}