Cuemon .NET Framework
FirstOrDefault<TSource> Method

The type of the elements of source.
The IEnumerable to return the first element of.
Returns the first element of a sequence, or a default value if the sequence contains no elements.
Syntax
'Declaration
 
Public Shared Function FirstOrDefault(Of TSource)( _
   ByVal source As IEnumerable(Of TSource) _
) As TSource
public static TSource FirstOrDefault<TSource>( 
   IEnumerable<TSource> source
)

Parameters

source
The IEnumerable to return the first element of.

Type Parameters

TSource
The type of the elements of source.

Return Value

default(TSource) if source is empty; otherwise, the first element in source.
Exceptions
ExceptionDescription
System.ArgumentNullExceptionsource is null.
Remarks
The default value for reference and nullable types is null.
Requirements

Target Platforms: Windows 8, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

EnumerableUtility Class
EnumerableUtility Members

 

 


| Cuemon is licensed under a The MIT License (MIT)



© 2009-2015 Weubphoria. All Rights Reserved.

Documentation made easy with Document! X by Innovasys

Send Feedback