當前位置: 首頁>>代碼示例>>C#>>正文


C# JsonTextWriter.Write方法代碼示例

本文整理匯總了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();
            }
開發者ID:gro-ove,項目名稱:actools,代碼行數:23,代碼來源:BaseAssistsViewModel.cs

示例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();
            }
開發者ID:gro-ove,項目名稱:actools,代碼行數:30,代碼來源:SessionStats.cs

示例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();
            }
開發者ID:gro-ove,項目名稱:actools,代碼行數:27,代碼來源:RaceGridViewModel.cs


注:本文中的Newtonsoft.Json.JsonTextWriter.Write方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。