Click or drag to resize
DfsExtensionsSearch Method (IDfsFile, DateTime)
Searches the dfs file for the time step index of a time, and returns the zero-based time step index. The time axis of the file must be a calendar type time axis

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.

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: 16.0.0.0 (11.1.1.1111)
Syntax
public static int Search(
	this IDfsFile dfsFile,
	DateTime time
)

Parameters

dfsFile
Type: DHI.Generic.MikeZero.DFSIDfsFile
Dfs file to search in
time
Type: SystemDateTime
The time to locate.

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