예제 #1
0
        public static Int64 GetInt64(this IEnumerator <byte> enumerator)
        {
            var bytes = new byte[8];

            enumerator.CopyTo(bytes, 0, bytes.Length);
            return(BitConverter.ToInt64(bytes, 0));
        }
예제 #2
0
        public static char GetCharUtf16(this IEnumerator <byte> enumerator)
        {
            var bytes = new byte[2];

            enumerator.CopyTo(bytes, 0, bytes.Length);
            return(BitConverter.ToChar(bytes, 0));
        }
예제 #3
0
        /// <summary>
        /// Converts any enumerator to an array.
        /// </summary>
        /// <typeparam name="T">The item type.</typeparam>
        /// <param name="enumerator">The enumerator to convert.</param>
        /// <returns>Returns the resulting array.</returns>
        public static T[] ToArray <T>(this IEnumerator <T> enumerator)
        {
            var result = GlobalListPool <T> .Get();

            enumerator.CopyTo(result);
            var output = result.ToArray();

            GlobalListPool <T> .Put(result);

            return(output);
        }