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


C# ILArray.IsReadonly方法代码示例

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


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

示例1: Test_readonly

		public void Test_readonly() {
			int errorCode = 0;
			// after detaching all references but one, that storage is writeable ? 
			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);
				errorCode = 1; 
				if (B.IsReadonly() == true)
					throw new Exception();
				errorCode = 2;
                ILArray<object> A1 = B[3,"0:2,4;1,3;0;2,1,0,1"];
				if (A1.IsReadonly() == false | B.IsReadonly() == false)
					throw new Exception();
				errorCode = 3;
                ILArray<object> A2 = B.GetShifted(2);
				if (A1.IsReadonly() == false | B.IsReadonly() == false | A2.IsReadonly() == false)
					throw new Exception();
				errorCode = 4;
				A1.Detach();
				if (A1.IsReadonly() == true | B.IsReadonly() == false | A2.IsReadonly() == false)
					throw new Exception();
				errorCode = 5;
				A2.Detach();
				if (A1.IsReadonly() == true | B.IsReadonly() == true | A2.IsReadonly() == true)
					throw new Exception();
				errorCode = 6;
                ILArray<object> A3 = A2.S(3);
				if (A3.IsReadonly() == false | A2.IsReadonly() == false)
					throw new Exception();
				errorCode = 7;
				A2.Detach();
				if (A3.IsReadonly() == true | A2.IsReadonly() == true)
					throw new Exception();
				errorCode = 8;
				if (Object.Equals(A3,null)) {
                    ILArray<object> A4 = A3[2,"0:2,1"];
					if (A3.IsReadonly() == false | A4.IsReadonly() == false)
						throw new Exception();
					A4.Dispose();
				}
				// after leaving the scope -> A3 is only reference now? 
				// (Is not defined when the GC will clean up A4!)
				if (A3.IsReadonly() == true)
					throw new Exception("A3 should be writable!");
				Success("Test_readonly successful.");
			}
			catch (Exception e) {
				Error("Test_readonly failed at step: " + errorCode  + " Msg: " + e.Message);
			}
		}
开发者ID:wdxa,项目名称:ILNumerics,代码行数:52,代码来源:TESTILStorage.cs


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