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


C# JsonArray.RequireArgument方法代码示例

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


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

示例1: ReadPoint

 public static MapPoint ReadPoint( JsonArray coordinates )
 {
     coordinates.RequireArgument<JsonArray>( "coordinates" ).NotNull<JsonArray>();
     return ReadCoordinates( coordinates );
 }
开发者ID:OliveiraThales,项目名称:GeoCache,代码行数:5,代码来源:GeoJSONReader.cs

示例2: ReadCoordinates

        public static MapPoint ReadCoordinates( JsonArray coordinates )
        {
            coordinates.RequireArgument<JsonArray>( "coordinates" ).NotNull<JsonArray>();

            if( coordinates.Count > 3 )
                throw new InvalidOperationException( "Only a maximum of 3 coordinate values can be present." );
            if( coordinates.Count < 2 )
                throw new InvalidOperationException( "A minimum of 2 coordinate values must be present." );

            return new MapPoint( (double)coordinates[0], (double)coordinates[ 1 ] );
        }
开发者ID:OliveiraThales,项目名称:GeoCache,代码行数:11,代码来源:GeoJSONReader.cs

示例3: ReadLineString

        public static PointCollection ReadLineString( JsonArray points )
        {
            points.RequireArgument<JsonArray>( "points" ).NotNull<JsonArray>();

            PointCollection linestring = new PointCollection();
            foreach( JsonValue entry in points )
            {
                JsonArray coordinates = entry as JsonArray;
                linestring.Add(ReadPoint(coordinates));
            }
            return linestring;
        }
开发者ID:OliveiraThales,项目名称:GeoCache,代码行数:12,代码来源:GeoJSONReader.cs

示例4: ReadMultiPoint

        public static MultiPoint ReadMultiPoint( JsonArray points )
        {
            points.RequireArgument<JsonArray>( "points" ).NotNull<JsonArray>();

            MultiPoint multiPoint = new MultiPoint();
            foreach( JsonValue entry in points )
            {
                JsonArray coordinates = entry as JsonArray;
                multiPoint.Points.Add(ReadPoint(coordinates));
            }
            return multiPoint;
        }
开发者ID:OliveiraThales,项目名称:GeoCache,代码行数:12,代码来源:GeoJSONReader.cs

示例5: ReadRing

        private static PointCollection ReadRing( JsonArray points )
        {
            points.RequireArgument<JsonArray>( "points" ).NotNull<JsonArray>();

            PointCollection ringCoords = new PointCollection();
            foreach( JsonValue entry in points )
            {
                JsonArray coordinates = entry as JsonArray;
                ringCoords.Add( ReadPoint( coordinates ) );
            }
            return ringCoords;
        }
开发者ID:OliveiraThales,项目名称:GeoCache,代码行数:12,代码来源:GeoJSONReader.cs

示例6: ReadMultiLineString

        private static Geometry ReadMultiLineString( JsonArray paths )
        {
            paths.RequireArgument<JsonArray>( "paths" ).NotNull<JsonArray>();

            Polyline lines = new Polyline();
            foreach( JsonValue entry in paths )
            {
                JsonArray line = entry as JsonArray;
                lines.Paths.Add(ReadLineString(line));
            }

            return lines;
        }
开发者ID:OliveiraThales,项目名称:GeoCache,代码行数:13,代码来源:GeoJSONReader.cs

示例7: ReadRings

        private static Polygon ReadRings( JsonArray rings )
        {
            rings.RequireArgument<JsonArray>( "rings" ).NotNull<JsonArray>();

            Polygon areas = new Polygon();
            foreach( JsonValue entry in rings )
            {
                JsonArray line = entry as JsonArray;
                areas.Rings.Add( ReadRing( line ) );
            }

            return areas;
        }
开发者ID:OliveiraThales,项目名称:GeoCache,代码行数:13,代码来源:GeoJSONReader.cs

示例8: ReadPolygon

        private static Polygon ReadPolygon( JsonArray rings )
        {
            rings.RequireArgument<JsonArray>( "rings" ).NotNull<JsonArray>();

            return ReadRings( rings );
        }
开发者ID:OliveiraThales,项目名称:GeoCache,代码行数:6,代码来源:GeoJSONReader.cs

示例9: ReadMultiPolygon

        private static Geometry ReadMultiPolygon( JsonArray polygons )
        {
            polygons.RequireArgument<JsonArray>( "polygons" ).NotNull<JsonArray>();

            Polygon areas = new Polygon();
            foreach( JsonValue polygon in polygons )
            {
                JsonArray polygonCoords = polygon as JsonArray;
                Polygon poly = ReadPolygon( polygonCoords );
                poly.Rings.ForEach<PointCollection>( item => areas.Rings.Add( item ) );
            }

            return areas;
        }
开发者ID:OliveiraThales,项目名称:GeoCache,代码行数:14,代码来源:GeoJSONReader.cs

示例10: ReadLayerReferenceArray

        public static Dictionary<int, string> ReadLayerReferenceArray( JsonArray json )
        {
            json.RequireArgument<JsonArray>( "json" ).NotNull<JsonArray>();

            Dictionary<int, string> lyrRefs = new Dictionary<int, string>();
            foreach( JsonValue item in json )
            {
                if( !( item is JsonObject ) )
                    throw new FormatException( "All entries in a layer reference array should be of type JsonObjects." );

                KeyValuePair<int, string> entry = ReadLayerReference( item as JsonObject );
                lyrRefs.Add(entry.Key, entry.Value );
            }

            return lyrRefs;
        }
开发者ID:OliveiraThales,项目名称:GeoCache,代码行数:16,代码来源:ArcJSONReader.cs

示例11: ReadFieldMetadataArray

        public static List<FieldMetadata> ReadFieldMetadataArray( JsonArray json )
        {
            json.RequireArgument<JsonArray>( "json" ).NotNull<JsonArray>();

            List<FieldMetadata> flds = new List<FieldMetadata>();
            foreach( JsonValue item in json )
            {
                if( !( item is JsonObject ) )
                    throw new FormatException( "All entries in a field metadata array should be of type JsonObject." );

                FieldMetadata fld = ReadFieldMetadata( item as JsonObject );
                flds.Add( fld );
            }

            return flds;
        }
开发者ID:OliveiraThales,项目名称:GeoCache,代码行数:16,代码来源:ArcJSONReader.cs


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