Click or drag to resize

FileIOExtensionsPositionOf Method

Searches a binary stream for a given byte sequence.

Namespace: Altaxo.Serialization
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3448.0 (4.8.3448.0)
Syntax
C#
public static long PositionOf(
	this Stream stream,
	ReadOnlySpan<byte> sequence
)

Parameters

stream  Stream
The stream.
sequence  ReadOnlySpanByte
The searched sequence.

Return Value

Int64
When the sequence is found, it returns the position in the stream where the sequence starts; if the sequence was not found, -1 is returned.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Stream. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullExceptionThrown when stream is null.
ArgumentExceptionThrown when sequence is empty.
See Also