当前位置: 首页>>代码示例>>C#>>正文


C# Range.ToString方法代码示例

本文整理汇总了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]");
        }
开发者ID:phofman,项目名称:codetitans-libs,代码行数:16,代码来源:RangeTests.cs

示例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);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:9,代码来源:RangeTests.cs

示例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);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:9,代码来源:RangeTests.cs

示例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);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:10,代码来源:RangeTests.cs

示例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);
        }
开发者ID:jonathascosta,项目名称:SystemExtensions,代码行数:24,代码来源:RangeFixture.cs

示例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());
 }
开发者ID:aleksandert,项目名称:semver.net,代码行数:5,代码来源:SimpleRanges.cs

示例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);
 }
开发者ID:skonves,项目名称:ReferenceParser,代码行数:28,代码来源:RangeInfoTest.cs

示例8: CheckToString

 public void CheckToString()
 {
     var range = new Range<int>(3, 4);
     Assert.AreEqual("(3,4)", range.ToString());
 }
开发者ID:AllenConway,项目名称:SpackleNet,代码行数:5,代码来源:RangeTests.cs

示例9: sheet_SelectionChange

 private void sheet_SelectionChange(Range rng)
 {
     css.CurrentRange = rng;
     Globals.ThisAddIn.Application.StatusBar = rng.ToString();
     sendCurrentRange();
 }
开发者ID:risavkarna,项目名称:Sally,代码行数:6,代码来源:Alex.cs


注:本文中的Range.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。