Plugins/Drivers/DriverModbusMaster/NModbus4/Unme.Common/SequenceUtility.cs
(完整代码) 921Bnamespace Modbus.Unme.Common
{
using System;
using System.Collections.Generic;
using System.Linq;
internal static class SequenceUtility
{
public static IEnumerable<T> Slice<T>(this IEnumerable<T> source, int startIndex, int size)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
var enumerable = source as T[] ?? source.ToArray();
int num = enumerable.Count();
if (startIndex < 0 || num < startIndex)
{
throw new ArgumentOutOfRangeException(nameof(startIndex));
}
if (size < 0 || startIndex + size > num)
{
throw new ArgumentOutOfRangeException(nameof(size));
}
return enumerable.Skip(startIndex).Take(size);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
