Beispiel #1
0
 /// <summary>
 /// Serializes a <see cref="ArgCollection" /> instance to a byte array.
 /// </summary>
 /// <param name="input">The input <see cref="ArgCollection" />.</param>
 /// <returns>The serialized byte array.</returns>
 /// <exception cref="ArgumentException">Thrown if <paramref name="input" /> is <c>null</c>.</exception>
 public static byte[] ToBytes(ArgCollection input)
 {
     using (var ms = new EnhancedMemoryStream())
     {
         input.Write(ms);
         return(ms.ToArray());
     }
 }
Beispiel #2
0
        /// <summary>
        /// Returns a shallow clone of this instance.
        /// </summary>
        public ArgCollection Clone()
        {
            ArgCollection clone = new ArgCollection(assignChar, sepChar);

            foreach (KeyValuePair <string, string> entry in dictionary)
            {
                clone.dictionary.Add(entry.Key, entry.Value);
            }

            return(clone);
        }