当前位置: 首页>>代码示例>>C#>>正文


C# Range.IsInsideRange方法代码示例

本文整理汇总了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)));
 }
开发者ID:TGOSeraph,项目名称:StUtil,代码行数:10,代码来源:RangeTests.cs

示例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);
        }
开发者ID:heksesang,项目名称:Parchive.NET,代码行数:29,代码来源:ParWriter.cs

示例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;
 }
开发者ID:kiszu,项目名称:ForBlog,代码行数:12,代码来源:MemoryMapper.cs

示例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;
 }
开发者ID:kiszu,项目名称:ForBlog,代码行数:12,代码来源:MemoryMapper.cs


注:本文中的Range.IsInsideRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。