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


C# Decimal.Equals方法代码示例

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


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

示例1: ConvertDecimalToString

        public static String ConvertDecimalToString(Decimal value)
        {
            CultureInfo cultureInfo = CultureInfo.GetCultureInfo("vi-VN");   // try with "en-US"

            if (value.ToString().Equals(null) || value.ToString().Equals(String.Empty) || value.Equals(Decimal.Zero))
            {
                return AppConstraints.ZERO + AppConstraints.VND;
            }

            return (Decimal.Parse(value.ToString()).ToString("#,###.##", cultureInfo.NumberFormat)) + AppConstraints.VND;
        }
开发者ID:enjoyvinh,项目名称:project-hutech,代码行数:11,代码来源:ConvertCurrency.cs

示例2: CheckParamValue

 protected object CheckParamValue(Decimal paramValue)
 {
     if (paramValue.Equals(ClsConstants.NullDecimal))
     {
         return DBNull.Value;
     }
     else
     {
         return paramValue;
     }
 }
开发者ID:jiangguang5201314,项目名称:VMukti,代码行数:11,代码来源:ClsDataServiceBase.cs

示例3: CheckParamValue

 protected static object CheckParamValue(Decimal paramValue)
 {
     try
     {
         if (paramValue.Equals(Common.ClsConstants.NullDecimal))
         {
             return DBNull.Value;
         }
         else
         {
             return paramValue;
         }
     }
     catch (Exception ex)
     {
         VMuktiHelper.ExceptionHandler(ex, "CheckParamValue", "clsRecordingDataServiceBase.cs");
         return null;
     }
 }
开发者ID:jiangguang5201314,项目名称:VMukti,代码行数:19,代码来源:ClsDataServiceBase.cs

示例4: CheckParamValue

 protected object CheckParamValue(Decimal paramValue)
 {
     try
     {
         if (paramValue.Equals(ClsConstants.NullDecimal))
         {
             return DBNull.Value;
         }
         else
         {
             return paramValue;
         }
     }
     catch (Exception ex)
     {
         VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "CheckParamValue()", "ClsDataServiceBase.cs");   
         return null;
     }
 }
开发者ID:jiangguang5201314,项目名称:VMukti,代码行数:19,代码来源:ClsDataServiceBase.cs

示例5: CheckParamValue

 protected object CheckParamValue(Decimal paramValue)
 {
     if (paramValue.Equals(rptQuestionAnswers.Common.ClsConstants.NullDecimal))
     {
         return DBNull.Value;
     }
     else
     {
         return paramValue;
     }
 }
开发者ID:jiangguang5201314,项目名称:VMukti,代码行数:11,代码来源:ClsDataServiceBase.cs

示例6: runTest

 public virtual bool runTest()
   {
   int iCountErrors = 0;
   int iCountTestcases = 0;
   String strLoc="123_er";
   Console.Out.Write( strName );
   Console.Out.Write( ": " );
   Console.Out.Write( strPath + strTest );
   Console.Out.WriteLine( " runTest started..." );
   Decimal dcml1;
   Decimal dcml2;
   Decimal cncy1;
   try
     {
     do
       {
       dcml1 = new Decimal(12.1235);
       dcml2 = Decimal.Parse("12.1235", CultureInfo.InvariantCulture);
       ++iCountTestcases;
       if ( dcml1.Equals(dcml2) != true )
	 {
	 ++iCountErrors;
	 Console.Error.WriteLine(  "POINTTOBREAK: Error E_972qr! dcml1.Equals(dcml2) ==" + dcml1.Equals(dcml2)  );
	 }
       dcml1 = new Decimal(12.1235);
       dcml2 = Decimal.Parse("-12.1235", CultureInfo.InvariantCulture);
       ++iCountTestcases;
       if ( dcml1.Equals(dcml2) != false )
	 {
	 ++iCountErrors;
	 Console.Error.WriteLine(  "POINTTOBREAK: Error E_356dq! dcml1.Equals(dcml2) ==" + dcml1.Equals(dcml2)  );
	 }
       dcml1 = new Decimal(12.1235);
       cncy1 = Decimal.Parse("12.1233", CultureInfo.InvariantCulture);
       ++iCountTestcases;
       if ( dcml1.Equals(cncy1) != false )
	 {
	 ++iCountErrors;
	 Console.Error.WriteLine(  "POINTTOBREAK: Error E_394fg! dcml1.Equals(cncy1) ==" + dcml1.Equals(cncy1)  );
	 }
       dcml1 = new Decimal(12.1235);
       Co3559Equals_obj ob1 = new Co3559Equals_obj();
       ++iCountTestcases;
       if ( dcml1.Equals(ob1) != false )
	 {
	 ++iCountErrors;
	 Console.Error.WriteLine(  "POINTTOBREAK: Error E_935sd! dcml1.Equals(ob1) ==" + dcml1.Equals(ob1)  );
	 }
       dcml1 = new Decimal(12.1235);
       Co3559Equals_obj ob2 = null;
       ++iCountTestcases;
       if ( dcml1.Equals(ob2) != false )
	 {
	 ++iCountErrors;
	 Console.Error.WriteLine(  "POINTTOBREAK: Error E_745we! dcml1.Equals(ob2) ==" + dcml1.Equals(ob2)  );
	 }
       dcml1 = new Decimal(12.1235);
       ++iCountTestcases;
       if ( cncy1.Equals(null) != false )
	 {
	 ++iCountErrors;
	 Console.Error.WriteLine(  "POINTTOBREAK: Error E_359er! dcml1.Equals(null) ==" + dcml1.Equals(null)  );
	 }
       } while ( false );
     }
   catch (Exception exc_general)
     {
     ++iCountErrors;
     Console.Error.WriteLine ( "POINTTOBREAK: Error Err_103! strLoc=="+ strLoc + " ,exc_general=="+exc_general  );
     }
   if ( iCountErrors == 0 )
     {
     Console.Error.WriteLine( "paSs. " + strPath + strTest + "  iCountTestcases==" + iCountTestcases );
     return true;
     }
   else
     {
     Console.Error.WriteLine( "FAiL! " + strPath + strTest + "   iCountErrors==" + iCountErrors );
     return false;
     }
   }
开发者ID:ArildF,项目名称:masters,代码行数:81,代码来源:co3559equals_obj.cs

示例7: runTest

 public bool runTest()
   {
   Console.WriteLine(s_strTFPath + "\\" + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
   String strLoc = "Loc_000oo";
   String strValue = String.Empty;
   int iCountErrors = 0;
   int iCountTestcases = 0;
   try
     {
     Byte byScale;
     Int32 nHi,nMid,nLo;
     Boolean bIsNeg;
     Decimal dRet;
     Random rand = new Random ();
     Int32 [] iRets;
     Int32 nLastBit;
     strLoc = "Loc_498yg";
     iCountTestcases += 1;
     nLo = 0;
     nMid = 0;
     nHi = 0;
     bIsNeg = true;
     byScale = 20;
     dRet = new Decimal (nLo,nMid,nHi,bIsNeg,byScale);
     if (dRet != 0)
       {
       iCountErrors += 1;
       printerr ( "Error_323sc! Send in==(" + nLo.ToString() + "," + nMid.ToString() + "," + nHi.ToString() + "," + bIsNeg.ToString() + "," + byScale.ToString() + ") Expected==0 Value==" + dRet.ToString());
       }
     strLoc = "Loc_233fd";
     iCountTestcases += 1;
     nLo = unchecked ((int)4294967295);
     nMid = unchecked ((int)4294967295);
     nHi = unchecked ((int)4294967295);
     bIsNeg = false;
     byScale = 0;
     dRet = new Decimal (nLo,nMid,nHi,bIsNeg,byScale);
     if (!dRet.Equals(Decimal.MaxValue))
       {
       iCountErrors += 1;
       printerr ( "Error_763cd! Send in==(" + nLo.ToString() + "," + nMid.ToString() + "," + nHi.ToString() + "," + bIsNeg.ToString() + "," + byScale.ToString() + ") Expected==79228162514264337593543950335 Value==" + dRet.ToString());
       }
     strLoc = "Loc_893ko";
     iCountTestcases += 1;
     nLo = unchecked ((int)4294967295);
     nMid = unchecked ((int)4294967295);
     nHi = unchecked ((int)4294967295);
     bIsNeg = true;
     byScale = 0;
     dRet = new Decimal (nLo,nMid,nHi,bIsNeg,byScale);
     if (!dRet.Equals(Decimal.MinValue))
       {
       iCountErrors += 1;
       printerr ( "Error_168jk! Send in==(" + nLo.ToString() + "," + nMid.ToString() + "," + nHi.ToString() + "," + bIsNeg.ToString() + "," + byScale.ToString() + ") Expected==79228162514264337593543950335 Value==" + dRet.ToString());
       }
     strLoc = "Loc_486nj";
     for (int count = 0 ; count < 1000 ; count++)
       {
       iCountTestcases++;
       nLo = rand.Next(0, Int32.MaxValue);
       nMid = rand.Next(0, Int32.MaxValue);
       nHi = rand.Next(0, Int32.MaxValue);
       bIsNeg = Convert.ToBoolean (rand.Next(0, 2));
       byScale = (Byte) rand.Next(0, 29);
       dRet = new Decimal (nLo,nMid,nHi,bIsNeg,byScale);
       iRets = Decimal.GetBits (dRet);
       nLastBit = ((((IConvertible)bIsNeg).ToInt32(null)) << 31) | ((((IConvertible)byScale).ToInt32(null)) << 16);
       if ((nLo != iRets [0]) || (nMid != iRets [1]) || (nHi != iRets [2]) || (nLastBit != iRets[3]  ))
	 {
	 iCountErrors += 1;
	 printerr ( "Error_452ds_" + count + "! Send in==(" + nLo.ToString() + "," + nMid.ToString() + "," + nHi.ToString() + "," + bIsNeg.ToString() + "," + byScale.ToString() + ") Expected==79228162514264337593543950335 Value==" + dRet.ToString());
	 } 
       }
     strLoc = "Loc_481kd";
     iCountTestcases++;
     nLo = unchecked (20);
     nMid = unchecked (5);
     nHi = unchecked (9000);
     bIsNeg = true;
     byScale = 29;
     try
       {
       dRet = new Decimal (nLo,nMid,nHi,bIsNeg,byScale);
       iCountErrors++;
       printerr( "Error_812jc! no exception thrown");
       }
     catch (ArgumentOutOfRangeException)
       {
       printinfo( "Info_932ds! Caught ArgumentOutOfRangeException");
       }
     catch (Exception e)
       {
       ++iCountErrors;	
       printerr( "Error_001cs! Wrong exception thrown: " + e.ToString());
       }
     } catch (Exception exc_general ) {
     ++iCountErrors;
     Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general=="+exc_general.ToString());
     }
   if ( iCountErrors == 0 )
//.........这里部分代码省略.........
开发者ID:ArildF,项目名称:masters,代码行数:101,代码来源:co7084ctor_int32_int32_int32_boolean_byte.cs

示例8: CheckParamValue

 protected object CheckParamValue(Decimal paramValue)
 {
     if (paramValue.Equals(rptCountByDisposition.Common.ClsConstants.NullDecimal))
     {
         return DBNull.Value;
     }
     else
     {
         return paramValue;
     }
 }
开发者ID:jiangguang5201314,项目名称:VMukti,代码行数:11,代码来源:ClsDataServiceBase.cs


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