本文整理汇总了C#中System.Array.ThrowIfNull方法的典型用法代码示例。如果您正苦于以下问题:C# Array.ThrowIfNull方法的具体用法?C# Array.ThrowIfNull怎么用?C# Array.ThrowIfNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Array
的用法示例。
在下文中一共展示了Array.ThrowIfNull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Copy
/// <summary>
/// Copies a range of elements from an array starting at the first element and pastes them into another array starting
/// at
/// the first element. The length is specified as a 32-bit integer.
/// </summary>
/// <exception cref="ArgumentNullException">The source array can not be null.</exception>
/// <exception cref="ArgumentNullException">The Destination array can not be null.</exception>
/// <param name="sourceArray">The array that contains the data to copy.</param>
/// <param name="destinationArray">The array that receives the data.</param>
/// <param name="length">A 32-bit integer that represents the number of elements to copy.</param>
public static void Copy( this Array sourceArray, Array destinationArray, Int32 length )
{
sourceArray.ThrowIfNull( nameof( sourceArray ) );
destinationArray.ThrowIfNull( nameof( destinationArray ) );
Array.Copy( sourceArray, destinationArray, length );
}