TSource
IdeaBlade DevForce 2010 Help Reference
Single<TSource>(IEntityScalarQuery<TSource>,Action<EntityScalarQueryOperation<TSource>>,Object) Method
See Also  Example Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntityScalarAsyncExtensions Class > Single Method : Single<TSource>(IEntityScalarQuery<TSource>,Action<EntityScalarQueryOperation<TSource>>,Object) Method



source
userCallback
userState
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.

Syntax

Visual Basic (Declaration) 
<ExtensionAttribute()>
Public Overloads Shared Function Single(Of TSource)( _
   ByVal source As IEntityScalarQuery(Of TSource), _
   Optional ByVal userCallback As Action(Of EntityScalarQueryOperation(Of TSource)), _
   Optional ByVal userState As Object _
) As EntityScalarQueryOperation(Of TSource)
Visual Basic (Usage)Copy Code
Dim source As IEntityScalarQuery(Of TSource)
Dim userCallback As Action(Of EntityScalarQueryOperation(Of TSource))
Dim userState As Object
Dim value As EntityScalarQueryOperation(Of TSource)
 
value = EntityScalarAsyncExtensions.Single(Of TSource)(source, userCallback, userState)

Parameters

source
userCallback
userState

Type Parameters

TSource

Example

C#Copy Code
public void AsyncSingle() {
  var op = _entityManager.Employees.Where(e => e.Id == 1).AsScalarAsync().Single();
  op.Completed += (o, e) => {
    var emp = e.Result;
  };
}

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.