本文整理汇总了C#中RepeatedField.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# RepeatedField.ToString方法的具体用法?C# RepeatedField.ToString怎么用?C# RepeatedField.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RepeatedField
的用法示例。
在下文中一共展示了RepeatedField.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToString_Timestamp
public void ToString_Timestamp()
{
var list = new RepeatedField<Timestamp> { Timestamp.FromDateTime(new DateTime(2015, 10, 1, 12, 34, 56, DateTimeKind.Utc)) };
var text = list.ToString();
Assert.AreEqual("[ \"2015-10-01T12:34:56Z\" ]", text);
}
示例2: ToString_Struct
public void ToString_Struct()
{
var message = new Struct { Fields = { { "foo", new Value { NumberValue = 20 } } } };
var list = new RepeatedField<Struct> { message };
var text = list.ToString();
Assert.AreEqual(text, "[ { \"foo\": 20 } ]", message.ToString());
}
示例3: ToString_InvalidElementType
public void ToString_InvalidElementType()
{
var list = new RepeatedField<decimal> { 15m };
Assert.Throws<ArgumentException>(() => list.ToString());
}
示例4: ToString_Empty
public void ToString_Empty()
{
var list = new RepeatedField<TestAllTypes> { };
var text = list.ToString();
Assert.AreEqual("[ ]", text);
}
示例5: ToString_Messages
public void ToString_Messages()
{
var list = new RepeatedField<TestAllTypes> { new TestAllTypes { SingleDouble = 1.5 }, new TestAllTypes { SingleInt32 = 10 } };
var text = list.ToString();
Assert.AreEqual("[ { \"singleDouble\": 1.5 }, { \"singleInt32\": 10 } ]", text);
}
示例6: ToString_Strings
public void ToString_Strings()
{
var list = new RepeatedField<string> { "x", "y", "z" };
var text = list.ToString();
Assert.AreEqual("[ \"x\", \"y\", \"z\" ]", text);
}
示例7: ToString_Integers
public void ToString_Integers()
{
var list = new RepeatedField<int> { 5, 10, 20 };
var text = list.ToString();
Assert.AreEqual("[ 5, 10, 20 ]", text);
}