public void WriteNexts(IEnumerable <T> records)
#endif
        {
            if (mAsyncWriter == null)
            {
                throw new BadUsageException("Before call WriteNext you must call BeginWriteFile or BeginWriteStream.");
            }

            if (records == null)
            {
                throw new ArgumentNullException("The record to write can´t be null.");
            }

            bool first = true;


#if !GENERICS
            foreach (object rec in records)
#else
            foreach (T rec in records)
#endif
            {
                if (first)
                {
                    if (RecordType.IsAssignableFrom(rec.GetType()) == false)
                    {
                        throw new BadUsageException("The record must be of type: " + RecordType.Name);
                    }
                    first = false;
                }

                WriteRecord(rec);
            }
        }
        public void WriteNexts(T[] records)
#endif
        {
            if (mAsyncWriter == null)
            {
                throw new BadUsageException("Before call WriteNext you must call BeginWriteFile or BeginWriteStream.");
            }

            if (records == null)
            {
                throw new ArgumentNullException("The record to write can´t be null.");
            }

            if (records.Length == 0)
            {
                return;
            }

            if (RecordType.IsAssignableFrom(records[0].GetType()) == false)
            {
                throw new BadUsageException("The record must be of type: " + RecordType.Name);
            }

#if !GENERICS
            foreach (object rec in records)
#else
            foreach (T rec in records)
#endif
            {
                WriteRecord(rec);
            }
        }
        public void WriteNext(T record)
#endif
        {
            if (mAsyncWriter == null)
            {
                throw new BadUsageException("Before call WriteNext you must call BeginWriteFile or BeginWriteStream.");
            }

            if (record == null)
            {
                throw new BadUsageException("The record to write can´t be null.");
            }

            if (RecordType.IsAssignableFrom(record.GetType()) == false)
            {
                throw new BadUsageException("The record must be of type: " + RecordType.Name);
            }

            WriteRecord(record);
        }