本文整理汇总了C#中Pair.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Pair.ToString方法的具体用法?C# Pair.ToString怎么用?C# Pair.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pair
的用法示例。
在下文中一共展示了Pair.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestToString
public void TestToString()
{
Pair<string, string> test = new Pair<string, string>("a", "b");
Assert.AreEqual(test.ToString(), "a b");
Pair<string, string> oneNull = new Pair<string, string>("a", null);
Assert.AreEqual(oneNull.ToString(), "a null");
Pair<string, string> twoNulls = new Pair<string, string>();
Assert.AreEqual(twoNulls.ToString(), "null null");
}
示例2: dvcButton_Click
private void dvcButton_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
Pair p = new Pair("DVC", openFileDialog.FileName);
pairs.Add(p);
list.Items.Add(p.ToString());
}
}
示例3: Main
static void Main(string[] args)
{
//DateTime date = new DateTime(1993, 03, 20);
//Time time = new Time(date);
//Console.WriteLine(time.ToString());
//Console.WriteLine(Time.Now());
Pair<int> pair = new Pair<int>();
Console.WriteLine(pair.ToString());
//Fractions a = new Fractions(5, 5);
//Fractions b = new Fractions(4, 3);
//Console.WriteLine(a - b);
}
示例4: CanToStringNullablePair
public void CanToStringNullablePair()
{
var pair1 = new Pair<int?>(1, null);
pair1.ToString().Should().Be("1, ");
}
示例5: ToStringTest
public void ToStringTest()
{
Pair<int, object> p = new Pair<int, object>();
Assert.AreEqual("(0; )", p.ToString());
p.First = 10;
p.Second = "Hallo";
Assert.AreEqual("(10; Hallo)", p.ToString());
}
示例6: ToStringTest
public void ToStringTest()
{
Pair<int> p = new Pair<int>();
Assert.AreEqual("(0; 0)", p.ToString());
p.First = 10;
p.Second = 20;
Assert.AreEqual("(10; 20)", p.ToString());
}