当前位置: 首页>>代码示例>>C#>>正文


C# Array.GetUpperBound方法代码示例

本文整理汇总了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);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:14,代码来源:OleDbErrorCollection.cs

示例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;
		}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:49,代码来源:PropertySet.cs


注:本文中的Array.GetUpperBound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。