示例#1
0
        /// <summary>
        /// Concatenates a pointer onto the current pointer.
        /// </summary>
        /// <param name="other">Another pointer.</param>
        /// <returns>A new pointer.</returns>
        public JsonPointer Combine(JsonPointer other)
        {
            var segments = new PointerSegment[Segments.Length + other.Segments.Length];

            Segments.CopyTo(segments, 0);
            other.Segments.CopyTo(segments, Segments.Length);

            return(new JsonPointer
            {
                Segments = segments,
                Kind = IsUriEncoded ? JsonPointerKind.UriEncoded : JsonPointerKind.Plain
            });
        }
示例#2
0
        /// <summary>
        /// Concatenates additional segments onto the current pointer.
        /// </summary>
        /// <param name="additionalSegments">The additional segments.</param>
        /// <returns>A new pointer.</returns>
        public JsonPointer Combine(params PointerSegment[] additionalSegments)
        {
            var segments = new PointerSegment[Segments.Length + additionalSegments.Length];

            Segments.CopyTo(segments, 0);
            additionalSegments.CopyTo(segments, Segments.Length);

            return(new JsonPointer
            {
                Segments = segments,
                Kind = IsUriEncoded ? JsonPointerKind.UriEncoded : JsonPointerKind.Plain
            });
        }
示例#3
0
 public string[] GetSegments()
 {
     string[] segmentsCopy = new string[Segments.Length];
     Segments.CopyTo(segmentsCopy, 0);
     return(segmentsCopy);
 }