Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8641417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:31:10+00:00 2026-06-12T11:31:10+00:00

I want to port some of my EntityFramework C# code into VB.NET. I’m trying

  • 0

I want to port some of my EntityFramework C# code into VB.NET. I’m trying different online code convertor but they can’t solve this problem for me.

I have these two functions.

public List<T> Find<T>(Func<T, bool> predicate) where T : class
    {
        var objectSet = db.CreateObjectSet<T>();
        return objectSet.Where<T>(predicate).ToList();
    }

    public void Delete<T>(Func<T, bool> predicate) where T : class
    {
        var objectSet = db.CreateObjectSet<T>();
        IEnumerable<T> records = from x in objectSet.Where<T>(predicate) select x;

        foreach (T record in records)
        {
            objectSet.DeleteObject(record);
        }
    }

Now convertors tell me this:

Public Function Find(Of T As Class)(predicate As Func(Of T, Boolean)) As List(Of T)
    Dim objectSet = db.CreateObjectSet(Of T)()
    Return objectSet.Where(Of T)(predicate).ToList()
End Function

Public Sub Delete(Of T As Class)(predicate As Func(Of T, Boolean))
    Dim objectSet = db.CreateObjectSet(Of T)()
    Dim records As IEnumerable(Of T) = From x In objectSet.Where(Of T)(predicate) Select x

    For Each record As T In records
        objectSet.DeleteObject(record)
    Next
End Sub

But I get two errors, both for objectSet.Where<T>(predicate) which is:

Overload resolution failed because no accessible ‘Where’ accepts this number of type arguments.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:31:11+00:00Added an answer on June 12, 2026 at 11:31 am

    Simply remove the type argument from your call to Where, it’s unnecessary anyway. Secondly, decide on a style: either use LINQ or functions, not both.

    That is,

    • either write:

      Dim records As IEnumerable(Of T) = From x In objectSet Where predicate(x) Select x
      

      … but in VB you can leave off the Select x:

      Dim records As IEnumerable(Of T) = From x In objectSet Where predicate(x)
      
    • or write:

      Dim records As IEnumerable(Of T) = objectSet.Where(predicate)
      

    Same for Find. Simply write:

    Return objectSet.Where(predicate).ToList()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to port some Python code to .NET, and I was wondering
I want port some my Python scripts into web apps so that others can
I have a some doubles that I want to port into NSDecimalNumber, because I'm
I am trying to port some C++ code from Windows to Solaris(Unix). There are
I want to turn ON/OFF some port bits on ttyS2 suspend/resume scenario but from
I have a piece of .NET code which I want to port to 64-bit.
I'm trying to port some old MySQL queries to PostgreSQL, but I'm having trouble
i want to port my application to CodeIgniter but i am wondering whether i
i want to configure tomcat 7 to use port 80 on windows 7, but
I work on port of some casual games to Flash. They are based on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.