本文整理汇总了C#中Range.IsInsideRange方法的典型用法代码示例。如果您正苦于以下问题:C# Range.IsInsideRange方法的具体用法?C# Range.IsInsideRange怎么用?C# Range.IsInsideRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Range
的用法示例。
在下文中一共展示了Range.IsInsideRange方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsInsideRange
public void IsInsideRange()
{
Range<int> range = new Range<int>(1, 5);
Assert.IsTrue(range.IsInsideRange(new Range<int>(1, 5)));
Assert.IsFalse(range.IsInsideRange(new Range<int>(2, 4)));
Assert.IsFalse(range.IsInsideRange(new Range<int>(1, 1)));
Assert.IsTrue(range.IsInsideRange(new Range<int>(0, 5)));
Assert.IsFalse(range.IsInsideRange(new Range<int>(0, 4)));
Assert.IsFalse(range.IsInsideRange(new Range<int>(4, 6)));
}
示例2: Write
/// <summary>
/// Writes a <see cref="Packet"/> object to the currrent stream.
/// </summary>
/// <param name="packet">The <see cref="Packet"/> object.</param>
public void Write(Packet packet)
{
var range = new Range<long>();
range.Minimum = BaseStream.Position;
packet.Header.CopyTo(BaseStream);
packet.Body.CopyTo(BaseStream);
range.Maximum = BaseStream.Position - 1;
var overwrittenPackets = packets
.Where(x => range.IsInsideRange(new Range<long>
{
Minimum = x.Key,
Maximum = x.Key + x.Value - 1
}))
.Select(x => x.Key);
foreach (var key in overwrittenPackets)
{
packets = packets.Remove(key);
}
packets = packets.Add(range.Minimum, range.Maximum - range.Minimum + 1);
}
示例3: GetStreamByRange
/// <summary>
/// Find Existing MemoryMappedStream that has requested range
/// </summary>
/// <param name="range">Find any existing MemoryMappedStreamContainer containing requested range</param>
/// <returns>existing MemoryMappedStreamContainer</returns>
private MemoryMappedStreamContainer GetStreamByRange(Range<Int64> range)
{
foreach (var ms in m_streams)
if (range.IsInsideRange(ms.Range))
return ms;
return null;
}
示例4: GetViewByRange
/// <summary>
/// Find Existing MemoryMappedView that has requested range
/// </summary>
/// <param name="range">Find any existing MemoryMappedViewContainer containing requested range</param>
/// <returns>existing MemoryMappedViewContainer </returns>
private MemoryMappedViewContainer GetViewByRange(Range<Int64> range)
{
foreach (var mv in m_views)
if (range.IsInsideRange(mv.Range))
return mv;
return null;
}