Element methods

Element methods are used to retrieve a secific element of a sequence. The methods can be devided in two groups:

  • The methods without OrDefault in the method name throw an exception, if the desidered element is not available
  • The methods with OrDefault in the method name return the default value, if the desidered element is not available

All the methods with the exception of Element and ElementOrDefault accept a condition as parameter.

TitleDescription
First method (with integers)An example that shows the use of First (integers) with XSharp
First method (objects with condition)An example that shows the use of First (objects with condition) with XSharp
FirstOrDefault method (with integers)An example that shows the use of FirstOrDefault (integers) with XSharp
Last method (with integers)An example that shows the use of Last (integers) with XSharp
LastOrDefault method (with objects)An example that shows the use of LastOrDefault (objects) with XSharp
LastOrDefault method (objects with condition)An example that shows the use of LastOrDefault (objects with condition) with XSharp