本文整理汇总了C#中System.Single.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Single.ToString方法的具体用法?C# Single.ToString怎么用?C# Single.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Single
的用法示例。
在下文中一共展示了Single.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetFloatValue
/// <summary>
/// Sets the primitive value to the given number.
/// </summary>
/// <param name="unitType">The unit of the number.</param>
/// <param name="value">The value of the number.</param>
/// <returns>The CSS primitive value instance.</returns>
public CSSPrimitiveValue SetFloatValue(UnitType unitType, Single value)
{
_text = value.ToString(CultureInfo.InvariantCulture) + ConvertUnitTypeToString(unitType);
unit = unitType;
data = value;
return this;
}
示例2: GenerateSingleFloatValue
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
protected virtual void GenerateSingleFloatValue(Single s) {
Output.Write(s.ToString("R", CultureInfo.InvariantCulture));
}
示例3: ToMonoBigInteger
public static Mono.Math.BigInteger ToMonoBigInteger(Single value)
{
return Mono.Math.BigInteger.Parse(value.ToString("#"));
}
示例4: ToSqlString
/// <summary>
/// Converts the value of the specified nullable single-precision floating point number to its equivalent SqlString representation.
/// </summary>
/// <param name="value">A nullable single-precision floating point number.</param>
/// <returns>The SqlString equivalent of the nullable single-precision floating point number.</returns>
public static SqlString ToSqlString(Single? value) { return value.HasValue ? value.ToString() : SqlString.Null; }
示例5: ToSqlString
/// <summary>Converts the value from <c>Single</c> to an equivalent <c>SqlString</c> value.</summary>
public static SqlString ToSqlString(Single p) { return p.ToString(); }
示例6: AddArgument
/// <summary> Adds a command argument. </summary>
/// <param name="argument"> The argument. </param>
public void AddArgument(Single argument)
{
_arguments.Add(argument.ToString(CultureInfo.InvariantCulture));
}
示例7: GetFormattedString
private string GetFormattedString(string strTextContent, string strFontName, Single sngFontSizeInPoints, double sngMaxWidthInPoints, long hanging)
{
System.Array varWordArray;
IMxApplication pMxApp = ArcMap.Application as IMxApplication;
IAppDisplay pAppDisplay = pMxApp.Display;
IDisplayTransformation pTransformation = pAppDisplay.DisplayTransformation;
IFontDisp pTextFont = new stdole.StdFontClass() as IFontDisp;
ITextSymbol pTextSymbol = new TextSymbolClass();
double dblXSize;
double dblYSize;
string strGoodWidth = "";
string strFinalString = "";
string strTestString = "";
int i;
// Split the string into an array of words
varWordArray = strTextContent.Split(' ') as System.Array;
// Set up the Font
pTextFont.Name = strFontName;
pTextFont.Size = decimal.Parse(sngFontSizeInPoints.ToString());
// Setup the Text Symbol
pTextSymbol.Font = pTextFont;
// Setup spacing string for hanging indent
int pSpaces, i3;
string hangingIndent;
pAppDisplay.StartDrawing(pAppDisplay.hDC, 0);
hangingIndent = ""; //minimum hanging indent
if (hanging > 0)
{
pTextSymbol.GetTextSize(pAppDisplay.hDC, pTransformation, " ", out dblXSize, out dblYSize);
pSpaces = (int)System.Math.Round(hanging / dblXSize);
for (i3 = 0; i3 == pSpaces; i3++)
{
hangingIndent = hangingIndent + " ";
}
} // do nothing if hanging is 0
pAppDisplay.FinishDrawing(); // done setting up the hanging indent
// Add each word into the test string and test for width
pAppDisplay.StartDrawing(pAppDisplay.hDC, 0);
long linesAdded = 0;
for (i = 0; i <= (int)varWordArray.GetUpperBound(0); i++)
{
if (strGoodWidth != "")
{
strTestString = strGoodWidth + " " + varWordArray.GetValue(i);
}
else
{
strTestString = varWordArray.GetValue(i).ToString();
}
// Get the TextSize
if (linesAdded == 0)
{
pTextSymbol.GetTextSize(pAppDisplay.hDC, pTransformation, strTestString, out dblXSize, out dblYSize);
}
else
{
pTextSymbol.GetTextSize(pAppDisplay.hDC, pTransformation, " " + strTestString, out dblXSize, out dblYSize);
}
// If the word added is < max width keep adding to the line, else make a new one
if (dblXSize < sngMaxWidthInPoints)
{
strGoodWidth = strTestString;
}
else
{
if (linesAdded == 0)
{
strFinalString = hangingIndent + strGoodWidth;
}
else
{
strFinalString = strFinalString + Environment.NewLine + hangingIndent + " " + strGoodWidth;
}
linesAdded = linesAdded + 1;
strGoodWidth = varWordArray.GetValue(i).ToString();
}
}
strFinalString = strFinalString + Environment.NewLine + hangingIndent + " " + strGoodWidth;
pAppDisplay.FinishDrawing();
//return strFinalString.Substring(2);
return strFinalString;
}
示例8: GenerateSingleFloatValue
protected override void GenerateSingleFloatValue(Single s) {
Output.Write(s.ToString(CultureInfo.InvariantCulture));
Output.Write('F');
}
示例9: DrawBezier
/// <summary>
/// Implemented
/// </summary>
public void DrawBezier(Pen pen, Single x1, Single y1, Single x2, Single y2, Single x3, Single y3, Single x4, Single y4)
{
SvgPathElement bez = new SvgPathElement();
bez.D = "M " + x1.ToString() + " " + y1.ToString() + " C " +
x2.ToString() + " " + y2.ToString() + " " +
x3.ToString() + " " + y3.ToString() + " " +
x4.ToString() + " " + y4.ToString();
bez.Style = new SvgStyle(pen);
if (!_transforms.Result.IsIdentity)
bez.Transform = new SvgTransformList(_transforms.Result.Clone());
_cur.AddChild(bez);
}
示例10: Rule3
public void Rule3(float dt, World world){
switch (s3)
{
case -1:
___debug230 = AttackingShips.Count.ToString();
___AmountOfAttackingShips30 = (
(AttackingShips).Select(__ContextSymbol200 => new { ___i35 = __ContextSymbol200 })
.Where(__ContextSymbol201 => ((NextPossibleOwner.IsSome) && (((__ContextSymbol201.___i35.BaseShip.Owner) == (NextPossibleOwner.Value)))))
.Select(__ContextSymbol202 => __ContextSymbol202.___i35.BaseShip.AmountOfShips)
.Aggregate(default(System.Int32), (acc, __x) => acc + __x));
if(((((Planet.LandedShips) > (0))) && (((AttackingShips.Count) > (0)))))
{
goto case 2; }else
{
goto case 3; }
case 2:
count_down4 = 1f;
goto case 19;
case 19:
if(((count_down4) > (0f)))
{
count_down4 = ((count_down4) - (dt));
s3 = 19;
return; }else
{
goto case 17; }
case 17:
___RandomNumber30 = UnityEngine.Random.Range(3f,7f);
___FlankingBonus30 = ((((1f) + (((0.3f) * (AttackingShips.Count))))) - (0.3f));
___DamageFormula30 = ((((((((((System.Single)___AmountOfAttackingShips30)) * (6f))) * (___RandomNumber30))) * (___FlankingBonus30))) / (500f));
UnityEngine.Debug.Log(("Predamage ") + ((((((System.Single)___AmountOfAttackingShips30)) * (6f)) * (___RandomNumber30)) * (___FlankingBonus30)));
___FlankingBonusDebug30 = ___FlankingBonus30.ToString();
UnityEngine.Debug.Log(("FlankingBonus ") + (___FlankingBonus30));
___res31 = ((System.Int32)___DamageFormula30);
___Damage30 = ((___res31) + (1));
if(((Planet.LandedShips) > (___Damage30)))
{
goto case 5; }else
{
goto case 6; }
case 5:
Planet.LandedShips = ((Planet.LandedShips) - (___Damage30));
Planet.Owner = Planet.Owner;
s3 = -1;
return;
case 6:
Planet.LandedShips = 0;
Planet.Owner = Planet.Owner;
s3 = -1;
return;
case 3:
if(((((((Planet.LandedShips) == (0))) && (((AttackingShips.Count) > (0))))) && (NextPossibleOwner.IsSome)))
{
goto case 21; }else
{
s3 = -1;
return; }
case 21:
___new_attackingShips30 = (
(AttackingShips).Select(__ContextSymbol204 => new { ___i36 = __ContextSymbol204 })
.Where(__ContextSymbol205 => !(((__ContextSymbol205.___i36.BaseShip.Owner) == (NextPossibleOwner.Value))))
.Select(__ContextSymbol206 => __ContextSymbol206.___i36)
.ToList<AttackingShip>()).ToList<AttackingShip>();
if(((___new_attackingShips30.Count) > (0)))
{
goto case 22; }else
{
goto case 23; }
case 22:
Planet.LandedShips = ___AmountOfAttackingShips30;
Planet.Owner = (new Just<Commander>(NextPossibleOwner.Value));
s3 = -1;
return;
case 23:
Planet.LandedShips = ___AmountOfAttackingShips30;
Planet.Owner = (new Just<Commander>(NextPossibleOwner.Value));
s3 = -1;
return;
default: return;}}
示例11: Rule13
public void Rule13(float dt, World world){
switch (s13)
{
case -1:
___AttackRound130 = ((UnityEngine.Mathf.Round((Attack) * (10f))) / (10f));
___DefenseRound130 = ((UnityEngine.Mathf.Round((Defense) * (10f))) / (10f));
___ProductivityRound130 = ((UnityEngine.Mathf.Round((Productivity) * (10f))) / (10f));
___ResearchRound130 = ((UnityEngine.Mathf.Round((Research) * (10f))) / (10f));
AttackText = ___AttackRound130.ToString();
DefenseText = ___DefenseRound130.ToString();
ProductivityText = ___ProductivityRound130.ToString();
ResearchText = ___ResearchRound130.ToString();
s13 = -1;
return;
default: return;}}
示例12: Rule12
public void Rule12(float dt, World world){
switch (s12)
{
case -1:
if(Planet.Owner.IsSome)
{
goto case 34; }else
{
goto case 35; }
case 34:
___res120 = ((3f) / (((1f) + (((0.05f) * (Productivity))))));
NextShipInText = ___res120.ToString("0.##");
s12 = -1;
return;
case 35:
NextShipInText = "";
s12 = -1;
return;
default: return;}}
示例13: AddValue
public void AddValue(string protocolKey, Single value)
{
m_protocolText.Add(protocolKey + ProtocolKey.EqualSign + value.ToString());
}
示例14: SetFloat
public static void SetFloat(String key, Single value)
{
SetSettingRaw(key, value.ToString(CultureInfo.InvariantCulture), "float");
}
示例15: JSONNumberValue
/// <summary>
/// Public constructor that accepts a value of type single
/// </summary>
/// <param name="value">single (System.Single) value</param>
public JSONNumberValue(Single value)
: this(value.ToString("E", JSONNumberValue.JavaScriptNumberFormatInfo))
{
}