Home > @i2analyze/notebook-sdk > data > IReadOnlyCollection > firstOrDefault
data.IReadOnlyCollection.firstOrDefault() method
Returns the first object in the collection, or a default object if the collection is empty.
Signature:
firstOrDefault<U>(defaultValue: U): V | U;
Introduced: version 1.0
Type Parameters
Parameter | Type | Description |
---|---|---|
U | any | The type of the default object. |
Parameters
Parameter | Type | Description |
---|---|---|
defaultValue | U | The object to return if the collection is empty. |
Returns:
V | U
The first object in the collection, or the default object if the collection is empty.