1

How would I translate this C# lambda expression into VB.NET ?

query.ExecuteAsync(op => op.Results.ForEach(Employees.Add));

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using IdeaBlade.Core;
using IdeaBlade.EntityModel;

namespace SimpleSteps { public class MainPageViewModel { public MainPageViewModel() { Employees = new ObservableCollection(); var mgr = new NorthwindIBEntities(); var query = mgr.Employees; query.ExecuteAsync(op => op.Results.ForEach(Employees.Add)); }

    public ObservableCollection<Employee> Employees { get; private set; }
}

}

// Summary: // Execute the query asynchronously. IdeaBlade.EntityModel.EntityManager.ExecuteQueryAsync() // // Parameters: // query: // This query // // Type parameters: // T: // Entity type returned public static EntityQueryOperation<T> ExecuteAsync<T>(this IEntityQuery<T> query); // // Summary: // Execute the query asynchronously. IdeaBlade.EntityModel.EntityManager.ExecuteQueryAsync() // // Parameters: // query: // This query public static EntityQueryOperation ExecuteAsync(this IEntityQuery query); // // Summary: // Execute the query asynchronously. IdeaBlade.EntityModel.EntityManager.ExecuteQueryAsync() // // Parameters: // query: // This query // // userCallback: // Callback invoked when the query completes // // userState: // Token to identify the query upon completion // // Type parameters: // T: // Entity type returned // // Remarks: // Provide a userCallback if you want to be notified when the operation completes. // The query results will be returned in the IdeaBlade.EntityModel.EntityQueriedEventArgs // passed to the userCallback. Use the userState to uniquely identify this // call. public static EntityQueryOperation<T> ExecuteAsync<T>(this IEntityQuery<T> query, Action<EntityQueryOperation<T>> userCallback, object userState = null); // // Summary: // Execute the query asynchronously. IdeaBlade.EntityModel.EntityManager.ExecuteQueryAsync() // // Parameters: // query: // This query // // userCallback: // Callback invoked when the query completes // // userState: // Token to identify the query upon completion // // Remarks: // Provide a userCallback if you want to be notified when the operation completes. // The query results will be returned in the IdeaBlade.EntityModel.EntityQueriedEventArgs // passed to the userCallback. Use the userState to uniquely identify this // call.`
2
  • already try it,gives error Error 1 Overload resolution failed because no accessible 'ExecuteAsync' can be called with these arguments Commented Apr 20, 2010 at 19:01
  • Again, what is the definition of ExecuteAsync? The IdeaBlade site doesn't provide any documentation. We need to know the actual signature of the method (what parameters it expects, all of the overloads, etc.) Commented Apr 20, 2010 at 19:39

3 Answers 3

2

Starting with 2010, VB10 supports non-functional lambdas.

query.ExecuteAsync(Sub(op) op.Results.ForEach(Employees.Add))
Sign up to request clarification or add additional context in comments.

4 Comments

also the same error already try it,gives error Error 1 Overload resolution failed because no accessible 'ExecuteAsync' can be called with these arguments
Can you provide the method definition for ExecuteAsync?
.... using IdeaBlade.Core; using IdeaBlade.EntityModel; namespace SimpleSteps { public class MainPageViewModel { public MainPageViewModel() { Employees = new ObservableCollection<Employee>(); var mgr = new NorthwindIBEntities(); var query = mgr.Employees; query.ExecuteAsync(op => op.Results.ForEach(Employees.Add)); } public ObservableCollection<Employee> Employees { get; private set; } } }
Err, please post it as an edit to your question, not as a comment.
1
query.ExecuteAsync(Function(op) op.Results.ForEach(Employees.Add))

also you can do this here: http://www.developerfusion.com/tools/convert/csharp-to-vb/

Comments

-1

I found the solution..

query.ExecuteAsync.Results.ForEach(Sub(o) Employees.Add(o))

Hope this helps to others

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.