本文整理汇总了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;
}
示例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 });
}
示例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;
}
示例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;
}
示例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;
}
示例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 });
}
示例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:
//.........这里部分代码省略.........
示例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;
}