Beispiel #1
0
 /// <summary>
 /// Initalizes an instance with entity type and raw entity text as a <see cref="StringSegment"/>
 /// </summary>
 /// <param name="type">The entity type for this instance.</param>
 /// <param name="segment">The raw entity text for this entity as a <see cref="StringSegment"/>.</param>
 protected EntityPart(T type, StringSegment segment)
 {
     Type         = type;
     m_sourceText = segment;
 }
Beispiel #2
0
 /// <summary>
 /// Intializes an instance with the associated entity type.
 /// </summary>
 /// <remarks>See <see cref="MimePart"/> for concrete parameterized instances.</remarks>
 /// <param name="type">The entity type for this instance.</param>
 public EntityPart(T type)
 {
     Type         = type;
     m_sourceText = StringSegment.Null;
 }
Beispiel #3
0
 /// <summary>
 /// Expands the source segment for this entity
 /// </summary>
 internal virtual void AppendSourceText(StringSegment segment)
 {
     m_sourceText.Union(segment);
 }
Beispiel #4
0
 internal MimePart(MimePartType type, StringSegment segment)
     : base(type, segment)
 {
 }
Beispiel #5
0
        // TODO: turn supplied code example into a unit test.

        /// <summary>
        /// Splits the supplied <see cref="StringSegment"/> by <paramref name="separator"/>, returning an enumeration of <see cref="StringSegment"/> instances for each header subpart.
        /// </summary>
        /// <param name="source">Segment to split.</param>
        /// <param name="separator">The value separator to split on.</param>
        /// <example>
        /// <code>
        /// StringSegment text = new StringSegment("a, b, c;d, e, f:g, e");
        /// IEnumerable&lt;StringSegment&gt; parts = Split(text, ',');
        /// foreach(StringSegment part in parts)
        /// {
        ///     Console.WriteLine(part);
        /// }
        /// // Prints:
        /// // a
        /// // b
        /// // c;d
        /// // e
        /// // f:g
        /// // e
        /// </code>
        /// </example>
        /// <returns>An enumeration of <see cref="StringSegment"/> instances, one for each parsed part.</returns>
        public static IEnumerable <StringSegment> Split(this StringSegment source, char separator)
        {
            return(StringSegment.Split(source, separator));
        }