本文整理汇总了C#中Int32.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Int32.ToString方法的具体用法?C# Int32.ToString怎么用?C# Int32.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Int32
的用法示例。
在下文中一共展示了Int32.ToString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyCtorInt32
private static bool VerifyCtorInt32(Int32 value)
{
bool ret = true;
BigInteger bigInteger;
bigInteger = new BigInteger(value);
if (!bigInteger.Equals(value))
{
Console.WriteLine("Expected BigInteger {0} to be equal to Int32 {1}", bigInteger, value);
ret = false;
}
if (String.CompareOrdinal(value.ToString(), bigInteger.ToString()) != 0)
{
Console.WriteLine("Int32.ToString() and BigInteger.ToString() on {0} and {1} should be equal", value, bigInteger);
ret = false;
}
if (value != (Int32)bigInteger)
{
Console.WriteLine("Expected BigInteger {0} to be equal to Int32 {1}", bigInteger, value);
ret = false;
}
if (value != Int32.MaxValue)
{
if ((Int32)(value + 1) != (Int32)(bigInteger + 1))
{
Console.WriteLine("Adding 1 to both {0} and {1} should remain equal", value, bigInteger);
ret = false;
}
}
if (value != Int32.MinValue)
{
if ((Int32)(value - 1) != (Int32)(bigInteger - 1))
{
Console.WriteLine("Subtracting 1 from both {0} and {1} should remain equal", value, bigInteger);
ret = false;
}
}
Assert.True(VerifyBigintegerUsingIdentities(bigInteger, 0 == value), " Verification Failed");
return ret;
}
示例2: VerifyCtorInt32
private static void VerifyCtorInt32(Int32 value)
{
BigInteger bigInteger = new BigInteger(value);
Assert.Equal(value, bigInteger);
Assert.Equal(0, String.CompareOrdinal(value.ToString(), bigInteger.ToString()));
Assert.Equal(value, (Int32)bigInteger);
if (value != Int32.MaxValue)
{
Assert.Equal((Int32)(value + 1), (Int32)(bigInteger + 1));
}
if (value != Int32.MinValue)
{
Assert.Equal((Int32)(value - 1), (Int32)(bigInteger - 1));
}
VerifyBigIntegerUsingIdentities(bigInteger, 0 == value);
}
示例3: ToString
public static string ToString(Int32 value)
{
return value.ToString();
}
示例4: ToString
///<include file='doc\XmlConvert.uex' path='docs/doc[@for="XmlConvert.ToString5"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public static string ToString(Int32 value)
{
return value.ToString(null, NumberFormatInfo.InvariantInfo);
}
示例5: GetMusicsByCategory
public String GetMusicsByCategory(Int32 category, String path )
{
DataTable _ds = m_dbObject.ReturnMusicByCategory(category.ToString(), this.ConnectionString);
String _imgPath;
String _xml = "<data>";
foreach (DataRow I in _ds.Rows)
{
_imgPath = String.Format(path, I["ID"].ToString(), I["FileType"].ToString());
_xml += "<musics>";
_xml += String.Format("<title><![CDATA[{0}]]></title>", I["Title"].ToString());
_xml += String.Format("<path><![CDATA[{0}]]></path>", _imgPath);
_xml += String.Format("<category><![CDATA[{0}]]></category>", I["CatDesc"].ToString());
_xml += "</musics>";
}
_xml += "</data>";
return _xml;
}
示例6: VerifyInt32ImplicitCastToBigInteger
private static void VerifyInt32ImplicitCastToBigInteger(Int32 value)
{
BigInteger bigInteger = value;
Assert.Equal(value, bigInteger);
Assert.Equal(value.ToString(), bigInteger.ToString());
Assert.Equal(value, (Int32)bigInteger);
if (value != Int32.MaxValue)
{
Assert.Equal((Int32)(value + 1), (Int32)(bigInteger + 1));
}
if (value != Int32.MinValue)
{
Assert.Equal((Int32)(value - 1), (Int32)(bigInteger - 1));
}
VerifyBigIntegerUsingIdentities(bigInteger, 0 == value);
}
示例7: GetKeyName
public string GetKeyName(Int32 nKey_p)
{
return nKey_p.ToString(CultureInfo.InvariantCulture);
}
示例8: AllPrimitivesMethod
private static string AllPrimitivesMethod(
bool boolean,
string str,
char character,
byte unsignedbyte,
sbyte signedbyte,
Int16 int16,
UInt16 uint16,
Int32 int32,
UInt32 uint32,
Int64 int64,
UInt64 uint64,
Single single,
Double dbl)
{
StringBuilder builder = new StringBuilder();
builder.Append(boolean.ToString() + ", ");
builder.Append(str + ", ");
builder.Append(character.ToString() + ", ");
builder.Append(unsignedbyte.ToString() + ", ");
builder.Append(signedbyte.ToString() + ", ");
builder.Append(int16.ToString() + ", ");
builder.Append(uint16.ToString() + ", ");
builder.Append(int32.ToString() + ", ");
builder.Append(uint32.ToString() + ", ");
builder.Append(int64.ToString() + ", ");
builder.Append(uint64.ToString() + ", ");
builder.Append(single.ToString() + ", ");
builder.Append(dbl);
return builder.ToString();
}
示例9: CreateArgumentList
public ArgumentsList CreateArgumentList(string sortExpression, Int32 maximumRows, Int32 startRowIndex, String cultureValue)
{
ArgumentsList _arg = new ArgumentsList();
_arg.Add(new ArgumentsListItem("Sort", sortExpression));
_arg.Add(new ArgumentsListItem("PageSize", maximumRows.ToString()));
_arg.Add(new ArgumentsListItem("PageNumber", startRowIndex.ToString()));
_arg.Add(new ArgumentsListItem("CultureName", cultureValue));
return _arg;
}
示例10: initialize
public void initialize()
{
sdk = new iRacingSDK();
sdk.Startup();
// check connection
if (sdk.IsConnected())
{
String yaml = sdk.GetSessionInfo();
// caridx
Int32 start = yaml.IndexOf("DriverCarIdx: ") + "DriverCarIdx: ".Length;
Int32 end = yaml.IndexOf("\n", start);
carIdx = Int32.Parse(yaml.Substring(start, end - start));
// carname
start = yaml.IndexOf("CarIdx: " + carIdx.ToString(), start);
start = yaml.IndexOf("CarPath: ", start) + "CarPath: ".Length;
end = yaml.IndexOf("\n", start);
if (start < 0)
carname = "unknown";
else
carname = yaml.Substring(start, end - start);
// track name
start = yaml.IndexOf("TrackName: ") + "TrackName: ".Length;
end = yaml.IndexOf("\n", start);
if (start < 0)
trackname = "unknown";
else
trackname = yaml.Substring(start, end - start);
// track length
start = yaml.IndexOf("TrackLength: ") + "TrackLength: ".Length;
end = yaml.IndexOf("km\n", start);
String dbg = yaml.Substring(start, end - start);
trackLength = (Int32)(Single.Parse(yaml.Substring(start, end - start)) * 1000);
// session types
RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Compiled;
MatchCollection sessionNums, sessionTypes;
Regex optionRegex = new Regex(@"SessionNum: (\d+)", options);
// Get matches of pattern in yaml
sessionNums = optionRegex.Matches(yaml);
optionRegex = new Regex(@"SessionType: (\w+)", options);
sessionTypes = optionRegex.Matches(yaml);
Int32 currentSessionNum = (Int32)sdk.GetData("SessionNum");
// Iterate matches
for (Int32 ctr = 0; ctr < Math.Min(sessionNums.Count, sessionTypes.Count); ctr++)
{
if (Int32.Parse(sessionNums[ctr].Value.Substring(12)) == currentSessionNum)
{
switch (sessionTypes[ctr].Value.Substring(13).Trim())
{
case "Practice":
sessiontype = iRacing.SessionTypes.practice;
break;
case "Qualify":
sessiontype = iRacing.SessionTypes.qualify;
break;
case "Race":
sessiontype = iRacing.SessionTypes.race;
break;
default:
sessiontype = iRacing.SessionTypes.invalid;
break;
}
}
}
// reset laptimes
lapStartTime = (Double)sdk.GetData("ReplaySessionTime");
lapTimeValid = false;
// fuel consumption, last 5 lap rolling
fuelcons = new Single[fuelconslaps];
fuelconsPtr = 0;
// init timedelta
timedelta = new TimeDelta(trackLength);
timedelta.SaveBestLap(carIdx);
LoadBestLap();
init = true;
}
else // retry next tick
{
init = false;
}
}