本文整理汇总了C#中Newtonsoft.Json.JsonTextWriter.Write方法的典型用法代码示例。如果您正苦于以下问题:C# JsonTextWriter.Write方法的具体用法?C# JsonTextWriter.Write怎么用?C# JsonTextWriter.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newtonsoft.Json.JsonTextWriter
的用法示例。
在下文中一共展示了JsonTextWriter.Write方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialize
public string Serialize() {
var s = new StringWriter();
var w = new JsonTextWriter(s);
w.WriteStartObject();
w.Write(nameof(IdealLine), IdealLine);
w.Write(nameof(AutoBlip), AutoBlip);
w.Write(nameof(StabilityControl), StabilityControl);
w.Write(nameof(AutoBrake), AutoBrake);
w.Write(nameof(AutoShifter), AutoShifter);
w.Write(nameof(SlipSteam), SlipSteam);
w.Write(nameof(AutoClutch), AutoClutch);
w.Write(nameof(Abs), Abs);
w.Write(nameof(TractionControl), TractionControl);
w.Write(nameof(VisualDamage), VisualDamage);
w.Write(nameof(Damage), Damage);
w.Write(nameof(TyreWear), TyreWear);
w.Write(nameof(FuelConsumption), FuelConsumption);
w.Write(nameof(TyreBlankets), TyreBlankets);
w.WriteEndObject();
return s.ToString();
}
示例2: Serialize
public string Serialize() {
var s = new StringWriter();
var w = new JsonTextWriter(s);
w.WriteStartObject();
w.Write(nameof(CarId), CarId);
w.Write(nameof(TrackId), TrackId);
w.Write(nameof(StartedAt), StartedAt);
w.Write(nameof(Time), Time);
w.Write(nameof(BestLap), BestLap);
w.Write(nameof(BestLapId), BestLapId);
w.WriteNonDefault(nameof(GoneOffroad), GoneOffroad);
w.WriteNonDefault(nameof(Penalties), Penalties);
w.WriteNonDefault(nameof(MaxSpeed), MaxSpeed, "F1");
w.WriteNonDefault(nameof(Distance), Distance, "F1");
w.WriteNonDefault(nameof(FuelBurnt), FuelBurnt, "F1");
w.WriteNonDefault(nameof(LongestAirborne), LongestAirborne, "F3");
w.WriteNonDefault(nameof(LongestWheelie), LongestWheelie, "F3");
w.WriteNonDefault(nameof(LongestTwoWheels), LongestTwoWheels, "F3");
w.WriteNonDefault(nameof(TotalAirborne), TotalAirborne, "F2");
w.WriteNonDefault(nameof(TotalWheelie), TotalWheelie, "F2");
w.WriteNonDefault(nameof(TotalTwoWheels), TotalTwoWheels, "F2");
w.WriteNonDefault(nameof(TotalTyreWear), TotalTyreWear, "F3");
w.WriteEndObject();
return s.ToString();
}
示例3: StringWriter
string IStringSerializable.Serialize() {
var s = new StringWriter();
var w = new JsonTextWriter(s);
w.WriteStartObject();
w.Write("ModeId", ModeId);
w.Write("FilterValue", FilterValue);
w.Write("CarIds", CarIds);
w.Write("CandidatePriorities", CandidatePriorities);
w.Write("AiLevels", AiLevels);
w.Write("Names", Names);
w.Write("Nationalities", Nationalities);
w.Write("SkinIds", SkinIds);
w.Write("AiLevelFixed", AiLevelFixed);
w.Write("AiLevelArrangeRandom", AiLevelArrangeRandom);
w.Write("AiLevelArrangeReverse", AiLevelArrangeReverse);
w.Write("AiLevel", AiLevel);
w.Write("AiLevelMin", AiLevelMin);
w.Write("OpponentsNumber", OpponentsNumber);
w.Write("StartingPosition", StartingPosition);
w.WriteEndObject();
return s.ToString();
}