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


C# ILArray.GetNumberOfReferences方法代码示例

本文整理汇总了C#中ILArray.GetNumberOfReferences方法的典型用法代码示例。如果您正苦于以下问题:C# ILArray.GetNumberOfReferences方法的具体用法?C# ILArray.GetNumberOfReferences怎么用?C# ILArray.GetNumberOfReferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILArray的用法示例。


在下文中一共展示了ILArray.GetNumberOfReferences方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_detach

		// detaching a ranged,shifted storage to new physical storage
		public void Test_detach() {
			int errorCode = 0;
			// success? 
			try {
				object[] data = new object[120];
				for (int i = 120; i-- > 0; )
					data[i] = (double)i;
                ILArray<object> B = new ILArray<object>(data, 5, 4, 1, 3, 2, 1 );
                ILArray<object> A = B[3,"0:2,4;1,3;0;2,1,0,1"];
				if (B.m_data.GetHashCode() != A.m_data.GetHashCode())
					throw new Exception();
				if (A.GetNumberOfReferences() != 2)
					throw new Exception();
				A.Detach();
				errorCode = 0;
                if (Object.Equals(A, null))
					throw new Exception();
				errorCode = 1;
				if (A.Dimensions.NumberOfDimensions != 3)
					throw new Exception();
				errorCode = 2;
				if (A.Dimensions[0] != 4
					| A.Dimensions[1] != 4
					| A.Dimensions[2] != 2)
					throw new Exception();
				errorCode = 3;
				object[] mdata = (object[])A.m_data; 
				if (mdata.Length != 32 || A.Dimensions.NumberOfElements != 32)
					throw new Exception();
				errorCode = 4;
				// soll werte: 
				double[] results = new double[32]{45,25,5,25,46,26,6,26,47,27,7,27,49,29
									,9,29,55,35,15,35,56,36,16,36,57,37,17,37,59,39,19,39};
				ILIterator<object> I = A.CreateIterator(ILIteratorPositions.ILStart, 0);
				int count = 0;
				do {
					if (((Double)I.Value).CompareTo(results[count++]) != 0)
						throw new Exception("Values did not match!");
					I.Increment();
				} while (!I.IsAtStart());
				errorCode = 5;
				mdata = (object[])A.m_data; 
				for (int i = 0; i < A.Dimensions.NumberOfElements; i++)
					if (mdata[i] != data[(int)results[i]])
						throw new Exception();
				errorCode = 6;
				if (A.GetNumberOfReferences() != 1)
					throw new Exception();
				errorCode = 7;
				if (B.GetNumberOfReferences() != 1)
					throw new Exception();
				errorCode = 8;
				if (A.m_data == B.m_data)
					throw new Exception();
				Success("Test_detach successful.");
			}
			catch (Exception e) {
				Error("Test_detach failed at step: " + errorCode  + " Msg: " + e.Message);
			}
		}
开发者ID:wdxa,项目名称:ILNumerics,代码行数:61,代码来源:TESTILStorage.cs


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