本文整理汇总了C#中Range.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Range.ToString方法的具体用法?C# Range.ToString怎么用?C# Range.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Range
的用法示例。
在下文中一共展示了Range.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeRange
public void SerializeRange()
{
Range r = new Range(10, 1);
Assert.AreEqual(r.ToString(), "{10, 1}");
Assert.AreNotEqual(r.ToString(), "{10,1}");
Assert.AreEqual(r.ToString("P"), "(10, 1)");
Assert.AreEqual(r.ToString("S"), "[10, 1]");
Range q = new Range(7, 23);
Assert.AreEqual(q.ToString(), "{7, 23}");
Assert.AreNotEqual(q.ToString(), "{7,1}");
Assert.AreEqual(q.ToString("P"), "(7, 23)");
Assert.AreEqual(q.ToString("S"), "[7, 23]");
}
示例2: ResultOfToStringCanConvertBackVector3D
public void ResultOfToStringCanConvertBackVector3D()
{
var rangeVector3D = new Range<Vector3D>(Vector3D.Zero, Vector3D.UnitX);
var converted3D = rangeVector3D.ToString();
var rangeRetrieved3D = new Range<Vector3D>(converted3D);
Assert.AreEqual("({0, 0, 0},{1, 0, 0})", converted3D);
Assert.AreEqual(rangeVector3D.Start, rangeRetrieved3D.Start);
Assert.AreEqual(rangeVector3D.End, rangeRetrieved3D.End);
}
示例3: ResultOfToStringCanConvertBackVector2D
public void ResultOfToStringCanConvertBackVector2D()
{
var rangeVector2D = new Range<Vector2D>(Vector2D.One, Vector2D.ScreenRight);
var converted2D = rangeVector2D.ToString();
var rangeRetrieved2D = new Range<Vector2D>(converted2D);
Assert.AreEqual("({1, 1},{1, 0})", converted2D);
Assert.AreEqual(rangeVector2D.Start, rangeRetrieved2D.Start);
Assert.AreEqual(rangeVector2D.End, rangeRetrieved2D.End);
}
示例4: ResultOfToStringCanConvertBackVectorColor
public void ResultOfToStringCanConvertBackVectorColor()
{
var rangeColor = new Range<Color>(Color.Red, Color.Black);
var convertedColors = rangeColor.ToString();
var rangeRetrieved = new Range<Color>(convertedColors);
Assert.AreEqual("({R=255, G=0, B=0, A=255},{R=0, G=0, B=0, A=255})",
convertedColors);
Assert.AreEqual(rangeColor.Start, rangeRetrieved.Start);
Assert.AreEqual(rangeColor.End, rangeRetrieved.End);
}
示例5: ToStringTest
public void ToStringTest()
{
const string format = "{0}..{1}";
var range = new Range<int>(1, 2);
var actual = range.ToString();
var expected = string.Format(format, range.Start, range.End);
Assert.AreEqual(expected, actual);
range = new Range<int>(1);
actual = range.ToString();
expected = string.Format(format, range.Start, "∞");
Assert.AreEqual(expected, actual);
range = new Range<int>(null, 2);
actual = range.ToString();
expected = string.Format(format, "∞", 2);
Assert.AreEqual(expected, actual);
range = new Range<int>(null);
actual = range.ToString();
expected = string.Format(format, "∞", "∞");
Assert.AreEqual(expected, actual);
}
示例6: RangeToString
public void RangeToString()
{
var range = new Range(">=1.2.7 <1.3.0");
Assert.Equal(">=1.2.7 <1.3.0", range.ToString());
}
示例7: ToStringTest3
public void ToStringTest3()
{
Range target = new Range
{
Start = new Verse
{
Index = 0,
BookName = "Genesis",
BookNumber = 1,
ChapterNumber = 1,
VerseNumber = 1,
Suffix = null
},
End = new Verse
{
Index = 2,
BookName = "Exodus",
BookNumber = 2,
ChapterNumber = 26,
VerseNumber = 37,
Suffix = null
},
};
string expected = "Genesis 1:1 - Exodus 26:37";
string actual;
actual = target.ToString();
Assert.AreEqual(expected, actual);
}
示例8: CheckToString
public void CheckToString()
{
var range = new Range<int>(3, 4);
Assert.AreEqual("(3,4)", range.ToString());
}
示例9: sheet_SelectionChange
private void sheet_SelectionChange(Range rng)
{
css.CurrentRange = rng;
Globals.ThisAddIn.Application.StatusBar = rng.ToString();
sendCurrentRange();
}