本文整理汇总了C#中Ref.IncRef方法的典型用法代码示例。如果您正苦于以下问题:C# Ref.IncRef方法的具体用法?C# Ref.IncRef怎么用?C# Ref.IncRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ref
的用法示例。
在下文中一共展示了Ref.IncRef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Bytes
// Load & cache full bytes array. Returns bytes.
public byte[] Bytes()
{
lock (this)
{
System.Diagnostics.Debug.Assert(refCount > 0 &&(origNorm == null || origNorm.refCount > 0));
if (bytes == null)
{
// value not yet read
System.Diagnostics.Debug.Assert(bytesRef == null);
if (origNorm != null)
{
// Ask origNorm to load so that for a series of
// reopened readers we share a single read-only
// byte[]
bytes = origNorm.Bytes();
bytesRef = origNorm.bytesRef;
bytesRef.IncRef();
// Once we've loaded the bytes we no longer need
// origNorm:
origNorm.DecRef();
origNorm = null;
}
else
{
// We are the origNorm, so load the bytes for real
// ourself:
int count = Enclosing_Instance.MaxDoc();
bytes = new byte[count];
// Since we are orig, in must not be null
System.Diagnostics.Debug.Assert(in_Renamed != null);
// Read from disk.
lock (in_Renamed)
{
in_Renamed.Seek(normSeek);
in_Renamed.ReadBytes(bytes, 0, count, false);
}
bytesRef = new Ref();
CloseInput();
}
}
return bytes;
}
}