本文整理汇总了C#中Decimal.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Decimal.SetValue方法的具体用法?C# Decimal.SetValue怎么用?C# Decimal.SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Decimal
的用法示例。
在下文中一共展示了Decimal.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)
//.........这里部分代码省略.........