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


C# Double.SetValue方法代码示例

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


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

示例1: runTest

 public bool runTest()
   {
   Console.Error.WriteLine( s_strTFPath +" "+ s_strTFName +" ,for "+ s_strClassMethod +"  ,Source ver "+ s_strDtTmVer );
   String strLoc="Loc_000oo";
   StringBuilder sblMsg = new StringBuilder( 99 );
   int iCountErrors = 0;
   int iCountTestcases = 0;
   int[] in4Arr1Orig;
   double[] doArr = { 0.1 ,1.2 ,2,3 };
   Object[] varArr1Orig;
   Int16[] in2Arr;
   Int32[] in4Arr;
   Int64[] in8Arr;
   Single[] sglArr;
   Double[] dblArr;
   Byte[] bytArr;
   SByte[] sbytArr;
   Decimal[] currArr;
   Decimal[] decArr;
   Object[] varArr;
   Object[] objArr;
   int in4Before;
   int in4After;
   Object varNewValue;
   Object obj1=null;
   try
     {
     do
       {
       strLoc="Loc_110dt";
       in4Arr1Orig = new int[3];
       for ( int ia = 0 ;ia < in4Arr1Orig.Length ;ia++ )
	 {
	 in4Arr1Orig[ia] = ia;
	 }
       in4Before = in4Arr1Orig[0];
       in4After = in4Arr1Orig.Length;
       varNewValue = in4After;
       in4Arr1Orig.SetValue( (Object)  varNewValue, 0 );
       ++iCountTestcases;
       if ( in4After != in4Arr1Orig[0] )
	 {
	 ++iCountErrors;
	 Console.WriteLine( s_strTFAbbrev +"Err_579yr!  in4After=="+ in4After +" ,in4Arr1Orig[0]=="+ in4Arr1Orig[0] );
	 }
       strLoc="Loc_132ke";
       in4Arr1Orig = new int[3];
       for ( int ia = 0 ;ia < in4Arr1Orig.Length ;ia++ )
	 {
	 in4Arr1Orig[ia] = ia;
	 }
       in4Before = in4Arr1Orig[0];
       in4After = in4Arr1Orig.Length;
       varNewValue = (int)in4After;
       in4Arr1Orig.SetValue( (Object) (int)varNewValue, 0  );
       ++iCountTestcases;
       if ( in4After != in4Arr1Orig[0] )
	 {
	 ++iCountErrors;
	 Console.WriteLine( s_strTFAbbrev +"Err_763bw!  in4After=="+ in4After +" ,in4Arr1Orig[0]=="+ in4Arr1Orig[0] );
	 }
       strLoc="Loc_110dt";
       doArr = new double[3];
       doArr[0] = 0.1;
       doArr[1] = 1.2;
       doArr[2] = 2.3;
       doArr.SetValue( (Object)  ( 3.4 ), 0  );
       ++iCountTestcases;
       if ( doArr[0] != 3.4 )
	 {
	 ++iCountErrors;
	 Console.WriteLine( s_strTFAbbrev +"Err_397xa!  doArr[0]=="+ doArr[0] );
	 }
       strLoc = "Loc_485eu";
       in2Arr = new Int16[2];
       iCountTestcases++;
       try {
       in2Arr.SetValue( (Object) 4, -1);
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_5287a");
       } catch (IndexOutOfRangeException) {}
       catch (Exception exc) {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_5278q, " + exc.ToString());
       }
       iCountTestcases++;
       try {
       in2Arr.SetValue( (Object) 4, 2);
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_523ua");
       } catch (IndexOutOfRangeException) {}
       catch ( Exception exc ) {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_234ay, " + exc.ToString());
       }
       in2Arr = new Int16[2];
       in2Arr.SetValue( (Object) (short)2, 0);
       in2Arr.SetValue( (Object)  (short)(-2), 1);
       iCountTestcases++;
       if(in2Arr[0] != 2 || in2Arr[1] != -2)
//.........这里部分代码省略.........
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:101,代码来源:co3750setvalue_vi.cs


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