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


C# Int32.Equals方法代碼示例

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


在下文中一共展示了Int32.Equals方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetDescription

        /// <summary>
        /// Returns the actual string representation for the specified lexical state ID.
        /// </summary>
        /// <param name="id">The lexical state ID to examine.</param>
        /// <returns>The actual string representation for the specified lexical state ID.</returns>
        public override String GetDescription(Int32 id)
        {
            var fields = typeof (JsonLexicalStateId).GetFields((BindingFlags.Public | BindingFlags.Static));
            for (var index = 0; (index < fields.Length); index = (index + 1))
            {
                var field = fields[index];
                if (id.Equals(field.GetValue(null)))
                {
                    var customAttributes = field.GetCustomAttributes(typeof (DescriptionAttribute), false);
                    if (((customAttributes != null) && (customAttributes.Length > 0)))
                        return ((DescriptionAttribute) (customAttributes[0])).Description;
                      
                    return field.Name;
                }
            }

            return null;
        }
開發者ID:925coder,項目名稱:ravendb,代碼行數:23,代碼來源:JsonLexicalStateId.g.cs

示例2: DeleteAmendment

        public ActionResult DeleteAmendment(Int32 projectVersionId, Int32 previousProjectVersionId)
        {
            //throw new NotImplementedException();
            CycleAmendment amendment = new CycleAmendment()
            {
                //LocationMapPath = _config.LocationMapPath,
                ProjectVersionId = projectVersionId
            };

            IDeleteStrategy strategy = new DeleteStrategy(this._rtpProjectRepository, amendment).PickStrategy();
            int returnId = strategy.Delete();
            previousProjectVersionId = !returnId.Equals(default(int)) ? returnId : previousProjectVersionId;

            if (!previousProjectVersionId.Equals(default(int)))
            {
                return RedirectToAction("Details", new { controller = "RtpProject", id = previousProjectVersionId });
            }

            string returnUrl = HttpContext.Request.UrlReferrer.PathAndQuery ?? String.Empty;

            if (!String.IsNullOrEmpty(returnUrl))
            {
                return Redirect(returnUrl);
            }
            return RedirectToAction("Index", new { controller = "Rtp", year = String.Empty });
        }
開發者ID:ccpowell,項目名稱:mvc4-examples,代碼行數:26,代碼來源:RtpProjectController.cs

示例3: GetKey

        /// <summary>
        /// Returns the string-based key for the specified AST node ID.
        /// </summary>
        /// <param name="id">The AST node ID to examine.</param>
        /// <returns>The string-based key for the specified AST node ID.</returns>
        public override String GetKey(Int32 id)
        {
            var fields = typeof (JsonAstNodeId).GetFields((BindingFlags.Public | BindingFlags.Static));
            for (var index = 0; (index < fields.Length); index = (index + 1))
            {
                var field = fields[index];
                if (id.Equals(field.GetValue(null)))
                    return field.Name;
            }

            return null;
        }
開發者ID:925coder,項目名稱:ravendb,代碼行數:17,代碼來源:JsonAstNodeId.g.cs

示例4: FindRowInDataView

        /// <summary>
        /// I have had to write this method because I could not get the DataView.Find to work (with dates?)
        /// </summary>
        /// <param name="ADataView">The DataView to search</param>
        /// <param name="FromCurrency"></param>
        /// <param name="ToCurrency"></param>
        /// <param name="EffectiveDate"></param>
        /// <param name="EffectiveTime"></param>
        /// <returns>The integer row index, or -1 if not found</returns>
        private Int32 FindRowInDataView(DataView ADataView, String FromCurrency, String ToCurrency, DateTime EffectiveDate, Int32 EffectiveTime)
        {
            for (int n = 0; n < ADataView.Count; n++)
            {
                object[] itemArray = ADataView[n].Row.ItemArray;

                if (FromCurrency.Equals(itemArray[ADailyExchangeRateTable.ColumnFromCurrencyCodeId])
                    && ToCurrency.Equals(itemArray[ADailyExchangeRateTable.ColumnToCurrencyCodeId])
                    && EffectiveDate.Equals(itemArray[ADailyExchangeRateTable.ColumnDateEffectiveFromId])
                    && EffectiveTime.Equals(itemArray[ADailyExchangeRateTable.ColumnTimeEffectiveFromId]))
                {
                    return n;
                }
            }

            return -1;
        }
開發者ID:Davincier,項目名稱:openpetra,代碼行數:26,代碼來源:SetupDailyExchangeRate.ManualCode.cs

示例5: CopyProject

        /// <summary>
        /// Copies a Project in the database
        /// </summary>
        /// <param name="projectVersionId"></param>
        /// <returns>ProjectVersionID</returns>
        public RtpSummary CopyProject(string plan, Int32 cycleId, Int32 projectVersionId)
        {
            CycleAmendment cycle = GetCurrentCycle(GetYearId(plan, Enums.TimePeriodType.PlanYear));

            RtpSummary result = null;
            using (SqlCommand command = new SqlCommand("[RTP].[CopyProject]") { CommandType = CommandType.StoredProcedure })
            {
                command.Parameters.AddWithValue("@CurrentProjectVersionId", projectVersionId);
                if(!String.IsNullOrEmpty(plan))
                    command.Parameters.AddWithValue("@TimePeriod", plan);
                if(!cycleId.Equals(default(Int32)) )
                    command.Parameters.AddWithValue("@CycleId", cycleId);

                using (IDataReader rdr = this.ExecuteReader(command))
                {
                    if (rdr.Read())
                    {
                        result = new RtpSummary()
                        {
                            SponsorAgency = rdr["Sponsor"].ToString()
                            ,
                            TIPId = rdr["TIPID"].ToString()
                            ,
                            RtpId = rdr["RtpYear"].ToString()
                            ,
                            RtpYear = rdr["RtpYear"] != DBNull.Value ? rdr["RtpYear"].ToString() : "NULL IN DATABASE"
                            ,
                            Title = rdr["ProjectName"] != DBNull.Value ? rdr["ProjectName"].ToString() : "NULL IN DATABASE"
                            ,
                            ProjectVersionId = (int)rdr["RTPProjectVersionID"]
                            ,
                            AmendmentStatus = rdr["AmendmentStatus"] != DBNull.Value ? rdr["AmendmentStatus"].ToString() : ""
                            ,
                            ImprovementType = rdr["ImprovementType"] != DBNull.Value ? rdr["ImprovementType"].ToString() : ""
                            ,
                            ProjectType = rdr["ProjectType"] != DBNull.Value ? rdr["ProjectType"].ToString() : ""
                            ,
                            PlanType = rdr["PlanType"].ToString()
                            ,
                            ProjectName = rdr["ProjectName"] != DBNull.Value ? rdr["ProjectName"].ToString() : ""
                            ,
                            // Set ToUpper to ensure results found. No case sensitive required.
                            COGID = rdr["COGID"] != DBNull.Value ? rdr["COGID"].ToString().ToUpper() : ""
                            ,
                            VersionStatus = rdr["ProjectVersionStatus"] != DBNull.Value ? rdr["ProjectVersionStatus"].ToString() : ""
                        };
                    }
                }
            }
            return result;
        }
開發者ID:ccpowell,項目名稱:mvc4-examples,代碼行數:56,代碼來源:RtpProjectRepository.cs

示例6: DeleteAmendment

        public ActionResult DeleteAmendment(Int32 projectVersionId, Int32 previousProjectVersionId, string year)
        {
            ProjectAmendments amendment = new ProjectAmendments()
            {
                LocationMapPath = _config.LocationMapPath,
                ProjectVersionId = projectVersionId
            };

            IDeleteStrategy strategy = new DeleteStrategy(this._projectRepository, amendment).PickStrategy();
            int returnId = strategy.Delete();
            previousProjectVersionId = returnId != 0 ? returnId : previousProjectVersionId;

            if (!previousProjectVersionId.Equals(default(int)))
            {
                return RedirectToAction("Details", new { controller = "Project", id = previousProjectVersionId, message = "Amendment deleted successfully." });
            }
            else
                return RedirectToAction("ProjectList", new { controller = "Tip", tipYear = year });
        }
開發者ID:ccpowell,項目名稱:mvc4-examples,代碼行數:19,代碼來源:ProjectController.cs

示例7: GetUnitIdFromLogicalId

        public static UnitId GetUnitIdFromLogicalId(UnitId structureBuildFrom, Int32 logicalId, Int32 maximumTime, Int32 mineralCost, Int32 vespineCost, int supply)
        {
            if (logicalId.Equals(0))
                return UnitId.NbXelNagaTower;

            if (!logicalId.Equals(-1))
            {

                var strStuff = Convert.ToString(logicalId, 16);
                strStuff = "1" + strStuff.Substring(1);

                var inumber = int.Parse(strStuff, NumberStyles.HexNumber);

                logicalId = inumber;
            }

            #region Terran

            #region CC - Orbital - PF

            if (structureBuildFrom.Equals(UnitId.TbCcGround))
            {
                //E.G. Upgrade to Lair/ Hive
                if (logicalId == -1)
                {
                    if (mineralCost == 150 && vespineCost == 0)
                        return UnitId.TupUpgradeToOrbital;

                    if (mineralCost == 150 && vespineCost == 150)
                        return UnitId.TupUpgradeToPlanetary;
                }

                return UnitId.TuScv;
            }

            if (structureBuildFrom.Equals(UnitId.TbPlanetary))
                return UnitId.TuScv;

            if (structureBuildFrom.Equals(UnitId.TbOrbitalGround))
                return UnitId.TuScv;

            #endregion

            #region Barracks

            if (structureBuildFrom.Equals(UnitId.TbBarracksGround))
            {
                /* Database for the units from the Barracks
                 * Unit         |   Time    |   Min |   Ves |   Sup
                 * -------------|-----------|-------|-------|-------
                 * Marine       |1638400    |   50  |   0   |   1
                 * Reaper       |2949120    |   50  |   50  |   1
                 * Marauder     |1966080    |   100 |   25  |   2
                 * Ghost        |2621440    |   200 |   100 |   2
                 * */

                switch (maximumTime)
                {
                    case 1638400:
                        return UnitId.TuMarine;

                    case 2949120:
                        return UnitId.TuReaper;

                    case 2621440:
                        return UnitId.TuGhost;

                    case 1966080:
                        return UnitId.TuMarauder;
                }
            }

            #endregion

            #region Factory

            else if (structureBuildFrom.Equals(UnitId.TbFactoryGround))
            {
                /* Database for the units from the Barracks
                * Unit         |   Time    |   Min |   Ves |   Sup
                * -------------|-----------|-------|-------|-------
                * Hellion      |1966080    |   100 |   0   |   2
                * Hellbat      |1966080    |   100 |   0   |   2
                * Mine         |2621440    |   75  |   25  |   2
                * Siege Tank   |2949120    |   150 |   125 |   3
                * Thor         |3932160    |   300 |   200 |   6
                * */

                if (logicalId.Equals(65541))
                    return UnitId.TuHellion;

                if (logicalId.Equals(65542))
                    return UnitId.TuHellbat;

                switch (maximumTime)
                {
                    case 3932160:
                        return UnitId.TuThor;

                    case 2621440:
//.........這裏部分代碼省略.........
開發者ID:hfenigma,項目名稱:AnotherSc2Hack,代碼行數:101,代碼來源:HelpFunctions.cs

示例8: GetReturnType

 /// <summary>
 /// Given the properties of an operator, gets its return type
 /// </summary>
 public static Int32 GetReturnType(String opName, Int32 lType, Int32 rType, Int32 precedance)
 {
     foreach (var op in Operators)
     {
         if (op.Name.Equals(opName) && precedance.Equals(op.Precedance) &&
             CheckTypesAreEqual(op.LType, lType) && CheckTypesAreEqual(op.RType, rType))
             return op.RetType;
     }
     return -1;
 }
開發者ID:AlexDiru,項目名稱:esper-compiler-v2,代碼行數:13,代碼來源:Database.cs


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