This project has moved. For the latest updates, please go here.

Additional Extension Method

Aug 24, 2014 at 10:42 PM
Edited Aug 24, 2014 at 10:42 PM
I'm using this library to parse large binary files and needed to read the with a UTF32 encoding. So I added an extension method to my own library, just thought I'd post it here.
        /// <summary>
        /// Creates the binary reader with UTF32 encoding.
        /// </summary>
        /// <param name="segment">The segment.</param>
        /// <returns></returns>
        public static BinaryReader CreateBinaryReaderUtf32(this ArraySegment<byte> segment)
        {
            Contract.Ensures(Contract.Result<BinaryReader>() != null);
            return new BinaryReader(segment.CreateStream(false), Encoding.UTF32);
        }   
Coordinator
Aug 29, 2014 at 2:45 PM
Sounds like a good extension method! I'll add something similar to the next version.

-Steve