2024-08-04 09:08:12 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Text;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace Rokojori
|
|
|
|
{
|
|
|
|
public class Arrays
|
|
|
|
{
|
2024-08-05 07:14:00 +00:00
|
|
|
public static bool Contains <T>( T[] values, T other )
|
|
|
|
{
|
|
|
|
return Array.IndexOf( values, other ) != -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static T[] Add<T>( T[] values, T other )
|
|
|
|
{
|
|
|
|
var newValues = new T[ values.Length + 1 ];
|
|
|
|
|
|
|
|
Array.Copy( values, newValues, values.Length );
|
|
|
|
newValues[ values.Length ] = other;
|
|
|
|
|
|
|
|
return newValues;
|
|
|
|
}
|
|
|
|
|
2024-08-04 09:08:12 +00:00
|
|
|
public static void ForEach<T>( T[] values, Action<T> callback )
|
|
|
|
{
|
|
|
|
foreach ( var it in values )
|
|
|
|
{
|
|
|
|
callback( it );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|