當前位置: 首頁>>代碼示例>>C#>>正文


C# SByte.GetValue方法代碼示例

本文整理匯總了C#中System.SByte.GetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# SByte.GetValue方法的具體用法?C# SByte.GetValue怎麽用?C# SByte.GetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.SByte的用法示例。


在下文中一共展示了SByte.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


注:本文中的System.SByte.GetValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。