Click or drag to resize

DfsExtensionsSearch Method (IDfsFile, Double)

Searches the dfs file for the time step index of a time, and returns the zero-based time step index.

NOTE: For the non-equidistant time axes, the metod will read the first item in the file for a number of timesteps in random order, performing a binary search in the file data on disc. This will be slow if used many times on the same file. In such a case, use the lazy version of GetDateTimes(IDfsFile, Boolean) or GetDateTimes(IDfsFile, DateTime, Boolean).

For the equidistant time axis, the method will calculate the time step index directly without reading data from the file.

Namespace:  DHI.Generic.MikeZero.DFS
Assembly:  DHI.Generic.MIKEZero.DFS (in DHI.Generic.MIKEZero.DFS.dll) Version: 19.0.0.0 (11.1.1.1111)
Syntax
public static int Search(
	this IDfsFile dfsFile,
	double relativeTime
)

Parameters

dfsFile
Type: DHI.Generic.MikeZero.DFSIDfsFile
Dfs file to search in
relativeTime
Type: SystemDouble
The time to locate, in the time unit of the time axis.

Return Value

Type: Int32
The zero-based index of the time in the dfs file, if time is found. Otherwise, the negative number that is the bitwise complement of the time step interval number, i.e. index of the next element that is larger than the time or, if there is no larger element, the bitwise complement of the number of time steps.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IDfsFile. 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).
See Also