Click or drag to resize

AddressAreaExtensionsIndexOfAddressT Method (IReadOnlyListT, AddressArea, FuncT, AddressArea)

Searches an ordered list of memory addressable areas using a binary search algorithm. Returns the index of the element that contains the address, or a negative number. The bitwise complement operator (~) can be applied to a negative result to produce the index of the first element (if any) that is larger than the given address.

Namespace:  Demo3D.PLC.Comms
Assembly:  PLC (in PLC.dll) Version: 15.0.2.11458
Syntax
C#
public static int IndexOfAddress<T>(
	this IReadOnlyList<T> areas,
	AddressArea address,
	Func<T, AddressArea> getArea
)

Parameters

areas
Type: System.Collections.GenericIReadOnlyListT
The list of address areas.
address
Type: Demo3D.PLC.CommsAddressArea
The address to search.
getArea
Type: SystemFuncT, AddressArea
Delegate for returning the address area from an element of areas.

Type Parameters

T
The type of the source object.

Return Value

Type: Int32
The index of the element that contains the address or a negative number. The bitwise complement operator (~) can be applied to a negative result to produce the index of the first element (if any) that is larger than the given address.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IReadOnlyListT. 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).
Remarks
This method does not work for overlapping addressable areas.
See Also