本文整理汇总了C#中Array.GetUpperBound方法的典型用法代码示例。如果您正苦于以下问题:C# Array.GetUpperBound方法的具体用法?C# Array.GetUpperBound怎么用?C# Array.GetUpperBound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array
的用法示例。
在下文中一共展示了Array.GetUpperBound方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyTo
public void CopyTo (Array array, int index)
{
if (array == null)
throw new ArgumentNullException("array");
if ((index < array.GetLowerBound (0)) || (index > array.GetUpperBound (0)))
throw new ArgumentOutOfRangeException("index");
// is the check for IsFixedSize required?
if ((array.IsFixedSize) || (index + this.Count > array.GetUpperBound (0)))
throw new ArgumentException("array");
((OleDbError[]) (items.ToArray ())).CopyTo (array, index);
}
示例2: CopyTo
/// <overload>
/// <para>Copies the <see cref='System.Management.PropertyDataCollection'/> into an array.</para>
/// </overload>
/// <summary>
/// <para>Copies the <see cref='System.Management.PropertyDataCollection'/> into an array.</para>
/// </summary>
/// <param name='array'>The array to which to copy the <see cref='System.Management.PropertyDataCollection'/>. </param>
/// <param name='index'>The index from which to start copying. </param>
public void CopyTo(Array array, Int32 index)
{
if (null == array)
throw new ArgumentNullException("array");
if ((index < array.GetLowerBound(0)) || (index > array.GetUpperBound(0)))
throw new ArgumentOutOfRangeException("index");
// Get the names of the properties
string[] nameArray = null;
object dummy = null;
int flag = 0;
if (isSystem)
flag |= (int)tag_WBEM_CONDITION_FLAG_TYPE.WBEM_FLAG_SYSTEM_ONLY;
else
flag |= (int)tag_WBEM_CONDITION_FLAG_TYPE.WBEM_FLAG_NONSYSTEM_ONLY;
flag |= (int)tag_WBEM_CONDITION_FLAG_TYPE.WBEM_FLAG_ALWAYS;
int status = this.parent.wbemObject.GetNames_(null, flag, ref dummy, out nameArray);
if (status >= 0)
{
if ((index + nameArray.Length) > array.Length)
throw new ArgumentException(null,"index");
foreach (string propertyName in nameArray)
array.SetValue(new PropertyData(parent, propertyName), index++);
}
if (status < 0)
{
if ((status & 0xfffff000) == 0x80041000)
ManagementException.ThrowWithExtendedInfo((ManagementStatus)status);
else
Marshal.ThrowExceptionForHR(status);
}
return;
}