Exemplo n.º 1
0
        /// <summary>
        /// Appends a substring of the specified string pointer to the <see cref="StringBuilder"/>.
        /// </summary>
        /// <param name="sb">The <see cref="StringBuilder"/> to which to append the value.</param>
        /// <param name="ptr">A pointer to the unmanaged string that contains the substring to append.</param>
        /// <param name="offset">The offset into the string at which the substring begins.</param>
        /// <param name="length">The length of the substring.</param>
        public static void AppendStringPtr(this StringBuilder sb, StringPtr8 ptr, Int32 offset, Int32 length)
        {
            Contract.Require(sb, nameof(sb));

            if (ptr == StringPtr8.Zero)
            {
                return;
            }

            for (int i = offset; i < offset + length; i++)
            {
                sb.Append(ptr[i]);
            }
        }
Exemplo n.º 2
0
 /// <inheritdoc/>
 public Boolean Equals(StringPtr8 other)
 {
     return
         (this.ptr == other.ptr &&
          this.length == other.length);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Appends the specified string pointer to the <see cref="StringBuilder"/>.
 /// </summary>
 /// <param name="sb">The <see cref="StringBuilder"/> to which to append the value.</param>
 /// <param name="ptr">A pointer to the unmanaged string to append.</param>
 public static void AppendStringPtr(this StringBuilder sb, StringPtr8 ptr)
 {
     AppendStringPtr(sb, ptr, 0, ptr.Length);
 }