v10.10.2024.0701 使用IJsonHost改进Json序列化
大石头 编写于 2024-07-01 08:36:34 大石头 提交于 2024-07-01 08:48:33
X
using System.Threading;

namespace System;

public static class ArrayExtensions
{
	public static TTarget[] ConvertAll<TSrc, TTarget>(this TSrc[] src, Func<TSrc, TTarget> converter)
	{
		if (src == null || converter == null)
		{
			return null;
		}
		TTarget[] array = new TTarget[src.Length];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = converter(src[i]);
		}
		return array;
	}

	public static void CheckArray(this WaitHandle handle, WaitHandle[] handles, bool waitAll)
	{
		if (handles == null)
		{
			throw new ArgumentNullException("waitHandles");
		}
		int num = handles.Length;
		if (num > 64)
		{
			throw new NotSupportedException("Too many handles");
		}
		if (handles.Length == 0)
		{
			if (waitAll)
			{
				throw new ArgumentNullException("waitHandles");
			}
			throw new ArgumentException();
		}
		foreach (WaitHandle waitHandle in handles)
		{
			if (waitHandle == null)
			{
				throw new ArgumentNullException("waitHandles", "null handle");
			}
		}
	}
}