本文整理汇总了C#中Reader.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Reader.Get方法的具体用法?C# Reader.Get怎么用?C# Reader.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reader
的用法示例。
在下文中一共展示了Reader.Get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Copy
/// <summary>
/// Same as <seealso cref="#copy(Reader, int, Mutable, int, int, int)"/> but using a pre-allocated buffer. </summary>
internal static void Copy(Reader src, int srcPos, Mutable dest, int destPos, int len, long[] buf)
{
Debug.Assert(buf.Length > 0);
int remaining = 0;
while (len > 0)
{
int read = src.Get(srcPos, buf, remaining, Math.Min(len, buf.Length - remaining));
Debug.Assert(read > 0);
srcPos += read;
len -= read;
remaining += read;
int written = dest.Set(destPos, buf, 0, remaining);
Debug.Assert(written > 0);
destPos += written;
if (written < remaining)
{
Array.Copy(buf, written, buf, 0, remaining - written);
}
remaining -= written;
}
while (remaining > 0)
{
int written = dest.Set(destPos, buf, 0, remaining);
destPos += written;
remaining -= written;
Array.Copy(buf, written, buf, 0, remaining);
}
}