public static T[] ToArray <T>(this AiNativeList <T> list) where T : unmanaged { T[] array = new T[list.Length]; int length = list.Length * UnsafeCollectionUtility.SizeOf <T>(); MemoryCopy.Copy((T *)list.GetUnsafePtr(), array, length); return(array); }
public static byte[] ToByteArray <T>(this AiNativeList <T> list) where T : unmanaged { int bytesToCopy = list.Length * UnsafeCollectionUtility.SizeOf <T>(); byte[] target = new byte[bytesToCopy]; MemoryCopy.Copy(list.GetUnsafePtr(), 0, target, 0, bytesToCopy); return(target); }
public static bool Contains <T, U>(this AiNativeList <T> list, U value) where T : unmanaged, IEquatable <U> { return(IndexOf <T, U>(list.GetUnsafePtr(), list.Length, value) != -1); }