当前位置: 首页>>代码示例>>C#>>正文


C# JsonWriter.WriteStartArray方法代码示例

本文整理汇总了C#中Raven.Imports.Newtonsoft.Json.JsonWriter.WriteStartArray方法的典型用法代码示例。如果您正苦于以下问题:C# JsonWriter.WriteStartArray方法的具体用法?C# JsonWriter.WriteStartArray怎么用?C# JsonWriter.WriteStartArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Raven.Imports.Newtonsoft.Json.JsonWriter的用法示例。


在下文中一共展示了JsonWriter.WriteStartArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteJsonCoordinatesEnumerable2

 private static void WriteJsonCoordinatesEnumerable2(JsonWriter writer, List<List<Coordinate[]>> coordinates, JsonSerializer serializer)
 {
     writer.WriteStartArray();
     foreach (List<Coordinate[]> coordinate in coordinates)
         WriteJsonCoordinatesEnumerable(writer, coordinate, serializer);
     writer.WriteEndArray();
 }
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:7,代码来源:CoordinateConverters.cs

示例2: WriteJsonCoordinates

 private static void WriteJsonCoordinates(JsonWriter writer, IEnumerable<Coordinate> coordinates, JsonSerializer serializer)
 {
     writer.WriteStartArray();
     foreach (Coordinate coordinate in coordinates)
         WriteJsonCoordinate(writer, coordinate, serializer);
     writer.WriteEndArray();
 }
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:7,代码来源:CoordinateConverters.cs

示例3: WriteJson

		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
		{
			var collection = (NameValueCollection)value;

			writer.WriteStartObject();

			foreach (var key in collection.AllKeys)
			{
				writer.WritePropertyName(key);

				var values = collection.GetValues(key);
				if (values == null)
				{
					writer.WriteNull();
					continue;
				}
				if (values.Length == 1)
				{
					writer.WriteValue(values[0]);
				}
				else
				{
					writer.WriteStartArray();

					foreach (var item in values)
					{
						writer.WriteValue(item);
					}

					writer.WriteEndArray();
				}

			}
			writer.WriteEndObject();
		}
开发者ID:randacc,项目名称:ravendb,代码行数:35,代码来源:NameValueCollectionJsonConverter.cs

示例4: WriteJson

 /// <summary>
 /// Writes the JSON representation of the object.
 /// </summary>
 /// <remarks>This will enumerate the Linq-To-Entities query before serializing it to json array</remarks>
 /// <param name="writer">The <see cref="JsonWriter"/> to write to.</param>
 /// <param name="value">The value.</param>
 /// <param name="serializer">The calling serializer.</param>
 public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
 {
     var enumerable = (IEnumerable) value;
     writer.WriteStartArray();
     foreach(var item in enumerable)
         writer.WriteValue(item);
     writer.WriteEndArray();
 }
开发者ID:heinnge,项目名称:ravendb,代码行数:15,代码来源:JsonLinqEnumerableConverter.cs

示例5: WriteArray

 private void WriteArray(JsonWriter writer, object value) {
     writer.WriteStartArray();
     var array = value as IEnumerable<object>;
     foreach (var o in array) {
         this.WriteValue(writer, o);
     }
     writer.WriteEndArray();
 }
开发者ID:anishpateluk,项目名称:shuriken,代码行数:8,代码来源:RavenDbDoughWriter.cs

示例6: WriteJsonCoordinate

        private static void WriteJsonCoordinate(JsonWriter writer, Coordinate coordinate, JsonSerializer serializer)
        {
            writer.WriteStartArray();

            writer.WriteValue(coordinate.X);
            writer.WriteValue(coordinate.Y);
            if (!Double.IsNaN(coordinate.Z))
                writer.WriteValue(coordinate.Z);
            
            writer.WriteEndArray();
        }
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:11,代码来源:CoordinateConverters.cs

示例7: WriteJson

        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            Envelope envelope = value as Envelope;
            if (envelope == null) return;

            writer.WritePropertyName("bbox");
            writer.WriteStartArray();
            writer.WriteValue(envelope.MinX);
            writer.WriteValue(envelope.MinY);
            writer.WriteValue(envelope.MaxX);
            writer.WriteValue(envelope.MaxY);
            writer.WriteEndArray();
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:13,代码来源:EnvelopeConverter.cs

示例8: WriteJson

            public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
            {
                writer.WriteStartArray();
                foreach (object item in (IEnumerable) value)
                {
                    writer.WriteStartObject();

                    writer.WritePropertyName("CrlType");
                    writer.WriteValue(item.GetType().AssemblyQualifiedName);

                    writer.WritePropertyName("Value");

                    serializer.Serialize(writer, item);

                    writer.WriteEndObject();
                }
                writer.WriteEndArray();
            }
开发者ID:holinov,项目名称:ZenEveCalc,代码行数:18,代码来源:RecordClrTypeInJsonContractResolver.cs

示例9: WriteJson

        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var coordinate = value as Coordinate;

            if (coordinate == null)
            {
                writer.WriteNull();
                return;
            }

            writer.WriteStartArray();
            writer.WriteValue(coordinate.Longitude);
            writer.WriteValue(coordinate.Latitude);
            if (coordinate.Is3D || coordinate.IsMeasured)
                writer.WriteValue(((Is3D)coordinate).Elevation);
            if (coordinate.IsMeasured)
                writer.WriteValue(((IsMeasured)coordinate).Measure);
            writer.WriteEndArray();
        }
开发者ID:asapostolov,项目名称:Geo,代码行数:19,代码来源:CoordinateConverter.cs

示例10: WriteHeader

			public void WriteHeader()
			{
				writer = new JsonTextWriter(new StreamWriter(stream));
				writer.WriteStartObject();
				writer.WritePropertyName("Results");
				writer.WriteStartArray();
			}
开发者ID:bbqchickenrobot,项目名称:ravendb,代码行数:7,代码来源:StreamsController.cs

示例11: WriteItemsFromDb

 private static void WriteItemsFromDb(JsonWriter jsonWriter, string name, Func<int, RavenJArray> getBatchOfItems)
 {
     jsonWriter.WritePropertyName(name);
     jsonWriter.WriteStartArray();
     var totalCount = 0;
     while (true)
     {
         var array = getBatchOfItems(totalCount);
         if (array.Length == 0)
         {
             break;
         }
         totalCount += array.Length;
         foreach (var item in array)
         {
             item.WriteTo(jsonWriter);
         }
     }
     jsonWriter.WriteEndArray();
 }
开发者ID:MrKevHunter,项目名称:SchoolsNearMe,代码行数:20,代码来源:RavenDbDumper.cs

示例12: WriteJsonCoordinatesEnumerable2

		protected static void WriteJsonCoordinatesEnumerable2(JsonWriter writer, CoordinateInfo[][][] coordinates)
		{
			writer.WriteStartArray();
			foreach (var coordinate in coordinates)
				WriteJsonCoordinatesEnumerable(writer, coordinate);
			writer.WriteEndArray();
		}
开发者ID:sibartlett,项目名称:RavenDB.Client.Spatial,代码行数:7,代码来源:GeoJsonWriter.cs

示例13: WriteGeometries

 private static void WriteGeometries(JsonWriter writer, IEnumerable<IGeometry> geometries, JsonSerializer serializer)
 {
     writer.WriteStartArray();
     foreach (IGeometry geometry in geometries)
         serializer.Serialize(writer, geometry);
     writer.WriteEndArray();
 }
开发者ID:925coder,项目名称:ravendb,代码行数:7,代码来源:GeometryConverter.cs

示例14: TryWriteGeo

		public bool TryWriteGeo(JsonWriter writer, object value, JsonSerializer serializer)
		{
			var route = value as Route;
			if (route != null)
			{
				writer.WriteStartObject();

				writer.WritePropertyName("__geo");
				writer.WriteStartObject();
				writer.WritePropertyName("type");
				writer.WriteValue("Route");
				if (route.Metadata.Count > 0)
				{
					writer.WritePropertyName("metadata");
					serializer.Serialize(writer, route.Metadata);
				}
				writer.WriteEndObject();

				writer.WritePropertyName("type");
				writer.WriteValue(Enum.GetName(typeof(ObjectType), ObjectType.LineString));

				writer.WritePropertyName("coordinates");
				WriteJsonCoordinates(writer, _shapeConverter.FromLineString(route.ToLineString()));

				writer.WriteEndObject();
				return true;
			}

			var track = value as Track;
			if (track != null)
			{
				writer.WriteStartObject();

				writer.WritePropertyName("__geo");
				writer.WriteStartObject();
				writer.WritePropertyName("type");
				writer.WriteValue("Track");
				if (track.Metadata.Count > 0)
				{
					writer.WritePropertyName("metadata");
					serializer.Serialize(writer, track.Metadata);
				}
				writer.WritePropertyName("times");
				writer.WriteStartArray();

				foreach (var segment in track.Segments)
				{
					writer.WriteStartArray();
					foreach (var fix in segment.Fixes)
						writer.WriteValue(fix.TimeUtc);
					writer.WriteEndArray();
				}

				writer.WriteEndArray();
				writer.WriteEndObject();

				writer.WritePropertyName("type");
				writer.WriteValue(Enum.GetName(typeof(ObjectType), ObjectType.LineString));

				writer.WritePropertyName("coordinates");
				WriteJsonCoordinates(writer, _shapeConverter.FromLineString(track.ToLineString()));

				writer.WriteEndObject();
				return true;
			}
			return false;
		}
开发者ID:sibartlett,项目名称:RavenDB.Client.Spatial,代码行数:67,代码来源:GeoJsonWriter.cs

示例15: TryWriteGeometryCollection

		public bool TryWriteGeometryCollection(JsonWriter writer, object value, JsonSerializer serializer)
		{
			if (!_shapeConverter.CanConvert(ObjectType.GeometryCollection))
				return false;

			ObjectType geomType = _shapeConverter.GetObjectType(value);
			if (geomType != ObjectType.GeometryCollection)
				return false;

			writer.WriteStartObject();
			writer.WritePropertyName("type");
			writer.WriteValue(Enum.GetName(typeof(ObjectType), geomType));

			writer.WritePropertyName("geometries");
			writer.WriteStartArray();
			foreach (var geometry in _shapeConverter.FromGeometryCollection(value))
				serializer.Serialize(writer, geometry);
			writer.WriteEndArray();

			writer.WriteEndObject();
			return true;
		}
开发者ID:sibartlett,项目名称:RavenDB.Client.Spatial,代码行数:22,代码来源:GeoJsonWriter.cs


注:本文中的Raven.Imports.Newtonsoft.Json.JsonWriter.WriteStartArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。