Breyta

Deila með


FileRecordSequence.BaseSequenceNumber Property

Definition

Gets the sequence number of the first valid record in the current FileRecordSequence.

public:
 property System::IO::Log::SequenceNumber BaseSequenceNumber { System::IO::Log::SequenceNumber get(); };
public System.IO.Log.SequenceNumber BaseSequenceNumber { get; }
member this.BaseSequenceNumber : System.IO.Log.SequenceNumber
Public ReadOnly Property BaseSequenceNumber As SequenceNumber

Property Value

The lowest sequence number that corresponds to a valid record in the FileRecordSequence.

Implements

Exceptions

The property was accessed after the sequence has been disposed of.

Examples

The following example shows using BaseSequenceNumber in a loop:

// Read the records added to the log.
    public void ReadRecords()
    {
        Encoding enc = Encoding.Unicode;

        Console.WriteLine();

        Console.WriteLine("Reading Log Records...");
        try
        {
            foreach (LogRecord record in this.sequence.ReadLogRecords(this.sequence.BaseSequenceNumber, LogRecordEnumeratorType.Next))
            {
                byte[] data = new byte[record.Data.Length];
                record.Data.Read(data, 0, (int)record.Data.Length);
                string mystr = enc.GetString(data);
                Console.WriteLine("    {0}", mystr);
            }
        }
        catch (Exception e)
        {
            Console.WriteLine("Exception {0} {1}", e.GetType(), e.Message);
        }

        Console.WriteLine();
    }
' Read the records added to the log. 
    Public Sub ReadRecords()
        Dim enc As Encoding = Encoding.Unicode

        Console.WriteLine()

        Console.WriteLine("Reading Log Records...")
        Try
            For Each record In Me.sequence.ReadLogRecords(Me.sequence.BaseSequenceNumber, LogRecordEnumeratorType.Next)
                Dim data(record.Data.Length - 1) As Byte
                record.Data.Read(data, 0, CInt(Fix(record.Data.Length)))
                Dim mystr As String = enc.GetString(data)
                Console.WriteLine("    {0}", mystr)
            Next record
        Catch e As Exception
            Console.WriteLine("Exception {0} {1}", e.GetType(), e.Message)
        End Try

        Console.WriteLine()
    End Sub

Remarks

Valid sequence numbers are greater than or equal to BaseSequenceNumber and less than LastSequenceNumber. All other sequence numbers are invalid.

The value of this property can be changed by calling the WriteRestartArea or AdvanceBaseSequenceNumber method.

Applies to