Microsoft.WindowsAzure.Commands.Tools.Vhd.Model.Persistence.VhdDataReader.BeginReadByte C# (CSharp) Method

BeginReadByte() public method

public BeginReadByte ( long offset, AsyncCallback callback, object state ) : IAsyncResult
offset long
callback AsyncCallback
state object
return IAsyncResult
        public IAsyncResult BeginReadByte(long offset, AsyncCallback callback, object state)
        {
            return BeginReadBytes(offset, 1, callback, state);
        }

Usage Example

        private IEnumerable <CompletionPort> ReadDiskGeometryAsync(AsyncMachine <DiskGeometry> machine, VhdPropertyAttribute attribute)
        {
            long offset = GetFooterOffset() + attribute.Offset;

            var attributeHelper = new AttributeHelper <DiskGeometry>();
            var diskGeometry    = new DiskGeometry();

            dataReader.BeginReadInt16(offset + attributeHelper.GetAttribute(() => diskGeometry.Cylinder).Offset, machine.CompletionCallback, null);
            yield return(CompletionPort.SingleOperation);

            diskGeometry.Cylinder = dataReader.EndReadInt16(machine.CompletionResult);

            dataReader.BeginReadByte(offset + attributeHelper.GetAttribute(() => diskGeometry.Heads).Offset, machine.CompletionCallback, null);
            yield return(CompletionPort.SingleOperation);

            diskGeometry.Heads = dataReader.EndReadByte(machine.CompletionResult);

            dataReader.BeginReadByte(offset + attributeHelper.GetAttribute(() => diskGeometry.Sectors).Offset, machine.CompletionCallback, null);
            yield return(CompletionPort.SingleOperation);

            diskGeometry.Sectors = dataReader.EndReadByte(machine.CompletionResult);

            machine.ParameterValue = diskGeometry;
        }