forked from BornToBeRoot/NETworkManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayHelper.cs
More file actions
24 lines (22 loc) · 716 Bytes
/
Copy pathArrayHelper.cs
File metadata and controls
24 lines (22 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
namespace NETworkManager.Utilities;
/// <summary>
/// Collection of useful methods to interact with an array.
/// </summary>
public static class ArrayHelper
{
/// <summary>
/// Create a sub array from an array.
/// </summary>
/// <typeparam name="T">Object array.</typeparam>
/// <param name="data">Any array.</param>
/// <param name="index">Start index.</param>
/// <param name="length">Length of the new array.</param>
/// <returns>Sub array of the array.</returns>
public static T[] SubArray<T>(this T[] data, int index, int length)
{
var result = new T[length];
Array.Copy(data, index, result, 0, length);
return result;
}
}