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


C# Decimal.GetValue方法代码示例

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


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

示例1: runTest

 public Boolean 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[] in4Array1Target = null; 
   int in4Index = -1;
   Object var3;
   String str3 = null;
   String[] str2Arr = null; 
   Int16[] in2Arr; 
   Int32[] in4Arr; 
   Int64[] in8Arr; 
   Single[] sglArr; 
   Double[] dblArr; 
   Byte[] bytArr; 
   SByte[] sbytArr; 
   Decimal[] currArr; 
   Decimal[] decArr; 
   try
     {
     do
       {
       strLoc="Loc_110dt";
       in4Array1Target = new int[ (int)Byte.MaxValue + 22 ];  
       for ( int ia = 0 ;ia < in4Array1Target.Length ;ia++ )
	 {
	 in4Array1Target[ia] = ia;
	 }
       in4Index =  (int)Byte.MaxValue + 6;
       var3 = in4Array1Target.GetValue( in4Index );
       ++iCountTestcases;
       if ( !var3.Equals(in4Index) )
	 {
	 ++iCountErrors;
	 Console.WriteLine( s_strTFAbbrev +"Err_342ji!  var3=="+ var3 );
	 }
       strLoc="Loc_325kf";
       str2Arr = new String[5];
       str2Arr.SetValue( "zero", 0 );
       str3 = (String)str2Arr.GetValue( 0 );
       ++iCountTestcases;
       if ( str3.Equals( str2Arr[0] ) != true )
	 {
	 ++iCountErrors;
	 Console.WriteLine( s_strTFAbbrev +"Err_084nw!  str2Arr[0]=="+ str2Arr[0] +" , str3=="+ str3 );
	 }
       strLoc = "Loc_374wq";
       bytArr = new Byte[2];
       bytArr[0] = (Byte)23;
       bytArr[1] = (Byte)5;
       iCountTestcases++;
       if(!bytArr.GetValue(0).Equals((Byte)23) || !bytArr.GetValue(1).Equals((Byte)5))
	 {
	 iCountErrors++;
	 Console.WriteLine( s_strTFAbbrev+ "Err_23093! , bytArr[0]=="+bytArr.GetValue(0)+" bytArr[1]=="+bytArr.GetValue(1));
	 }
       strLoc = "Loc_4281i";
       sbytArr = new SByte[2];
       sbytArr[0] = (SByte)(-5);
       sbytArr[1] = (SByte)4;
       iCountTestcases++;
       if(!sbytArr.GetValue(0).Equals((SByte)(-5)) || !sbytArr.GetValue(1).Equals((SByte)4))
	 {
	 iCountErrors++;
	 Console.WriteLine( s_strTFAbbrev+ "Err_299eu! , bytArr[0]=="+bytArr.GetValue(0)+", bytArr[1]=="+bytArr.GetValue(1));
	 }
       strLoc = "Loc_388uq";
       in2Arr = new Int16[2];
       in2Arr[0] = (short)3;
       in2Arr[1] = (short)20;
       iCountTestcases++;
       if(!in2Arr.GetValue(0).Equals((short)3) || !in2Arr.GetValue(1).Equals((short)20))
	 {
	 iCountErrors++;
	 Console.WriteLine( s_strTFAbbrev+ "Err_9823u");
	 }
       strLoc = "Loc_982ew";
       in4Arr = new Int32[2];
       in4Arr[0] = 5;
       in4Arr[1] = 200;
       iCountTestcases++;
       if(!in4Arr.GetValue(0).Equals(5) || !in4Arr.GetValue(1).Equals(200))
	 {
	 iCountErrors++;
	 Console.WriteLine( s_strTFAbbrev+ "Err_398yw");
	 }
       strLoc = "Loc_123uq";
       in8Arr = new Int64[2];
       in8Arr[0] = 32;
       in8Arr[1] = 878;
       iCountTestcases++;
       if(!in8Arr.GetValue(0).Equals((long)32) || !in8Arr.GetValue(1).Equals((long)878))
	 {
	 iCountErrors++;
	 Console.WriteLine( s_strTFAbbrev+ "Err_488ru! , inArr[0]=="+in8Arr.GetValue(0)+" inArr[1]=="+in8Arr.GetValue(1));
	 }
       strLoc = "Loc_0982i";
//.........这里部分代码省略.........
开发者ID:ArildF,项目名称:masters,代码行数:101,代码来源:co3747getvalue_i.cs

示例2: runTest


//.........这里部分代码省略.........
       Console.WriteLine( s_strTFAbbrev+ "Err_234uq");
       } catch (ArgumentException) {}
       catch (Exception exc) {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_383da! , exc=="+exc);
       }
       strLoc = "Loc_485ef";
       in4Arr = new Int32[2];
       iCountTestcases++;
       try {
       in4Arr.SetValue( (Object) 4, -1);
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_52ssa");
       } catch (IndexOutOfRangeException) {}
       catch (Exception exc) {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_5278q, " + exc.ToString());
       }
       iCountTestcases++;
       try {
       in4Arr.SetValue( (Object) (Object)4, 2);
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_52vua");
       } catch (IndexOutOfRangeException) {}
       catch ( Exception exc ) {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_234ay, " + exc.ToString());
       }
       strLoc = "Loc_373uy";
       in4Arr = new Int32[2];
       in4Arr.SetValue((Object)((short)2), 0 );
       in4Arr.SetValue((Object)(int) -20, 1);
       iCountTestcases++;
       if((Int32) in4Arr.GetValue(0) != 2 || in4Arr[1] != -20)
	 {
	 iCountErrors++;
	 Console.WriteLine( s_strTFAbbrev+ "Err_2349w");
	 }
       strLoc = "Loc_486ef";
       in8Arr = new Int64[2];
       iCountTestcases++;
       try {
       in8Arr.SetValue((Object)4, -1);
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_5234a");
       } catch (IndexOutOfRangeException) {}
       catch (Exception exc) {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_5228q, " + exc.ToString());
       }
       iCountTestcases++;
       try {
       in8Arr.SetValue((Object)4, 2);
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_524ua");
       } catch (IndexOutOfRangeException) {}
       catch ( Exception exc ) {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ "Err_233ay, " + exc.ToString());
       }
       strLoc = "Loc_373fg";
       in8Arr = new Int64[3];
       in8Arr.SetValue((Object)((short)2), 0);
       in8Arr.SetValue((Object)((int)-20), 1);
       in8Arr.SetValue((Object)((long)200), 2);
       iCountTestcases++;
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:67,代码来源:co3750setvalue_vi.cs


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