DynamicRest.JsonWriter.WriteValue C# (CSharp) Méthode

WriteValue() public méthode

public WriteValue ( System.DateTime dateTime ) : void
dateTime System.DateTime
Résultat void
        public void WriteValue(DateTime dateTime)
        {
            if (dateTime < JsonReader.MinDate) {
                throw new ArgumentOutOfRangeException("dateTime");
            }

            long value = ((dateTime.Ticks - JsonReader.MinDateTimeTicks) / 10000);
            WriteCore("\\@" + value.ToString(CultureInfo.InvariantCulture) + "@", /* quotes */ true);
        }

Same methods

JsonWriter::WriteValue ( ICollection items ) : void
JsonWriter::WriteValue ( IDictionary record ) : void
JsonWriter::WriteValue ( bool value ) : void
JsonWriter::WriteValue ( double value ) : void
JsonWriter::WriteValue ( float value ) : void
JsonWriter::WriteValue ( int value ) : void
JsonWriter::WriteValue ( object o ) : void
JsonWriter::WriteValue ( string s ) : void

Usage Example

Exemple #1
0
        public static void Run()
        {
            string jsonText = "{ xyz: 123, items: [ 10, 100, 1000 ], numbers: [ 0.123, .456 ], bools: [ true, false ], text: [ \"hello\", 'world\n!' ] }";

            JsonReader jsonReader = new JsonReader(jsonText);
            dynamic jsonObject = jsonReader.ReadValue();
            dynamic items = jsonObject.items;

            items[2] = 1001;

            dynamic bar = new JsonObject();
            bar.name = "c#";

            jsonObject.bar = bar;

            JsonWriter writer = new JsonWriter();
            writer.WriteValue((object)jsonObject);

            string newJsonText = writer.Json;

            Console.WriteLine(newJsonText);
        }
All Usage Examples Of DynamicRest.JsonWriter::WriteValue