本文整理汇总了C#中IArea.Write方法的典型用法代码示例。如果您正苦于以下问题:C# IArea.Write方法的具体用法?C# IArea.Write怎么用?C# IArea.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IArea
的用法示例。
在下文中一共展示了IArea.Write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyTo
public void CopyTo(IArea destArea, int size)
{
const int bufferSize = 2048;
byte[] buf = new byte[bufferSize];
int toCopy = System.Math.Min(size, bufferSize);
while (toCopy > 0) {
Read(buf, 0, toCopy);
destArea.Write(buf, 0, toCopy);
size -= toCopy;
toCopy = System.Math.Min(size, bufferSize);
}
}
示例2: CopyTo
public void CopyTo(IArea destArea, int size)
{
// NOTE: Assuming 'destination' is a StoreArea, the temporary buffer
// could be optimized away to a direct Array.Ccopy. However, this
// function would need to be written as a lower level IO function.
const int bufferSize = 2048;
byte[] buf = new byte[bufferSize];
int toCopy = System.Math.Min(size, bufferSize);
while (toCopy > 0) {
var read = Read(buf, 0, toCopy);
if (read == 0)
break;
destArea.Write(buf, 0, read);
size -= toCopy;
toCopy = System.Math.Min(size, bufferSize);
}
}