Users Pricing

forum

Home Forums LINQ to SQL execute method on select – MindStick

LINQ to SQL execute method on select

Anonymous User 2443 02 Sep 2014

I’m really new to LINQ so I'm trying to figure out how to execute method with lambda expressions.

   public void GetData()
    {
     using(MyClassesDataContext context = new MyClassesDataContext())
                {
                    var problems = (from p in context.Problems select p).Take(10);
                    problems.Select(t => DisplayData(t.Text));
                }
    }
     public void DisplayData(string Text)
            {
            }

I'm getting this error:

The type arguments for method 'System.Linq.Enumerable.Select(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

at this line:

 problems.Select(t => DisplayData(t.Text));

What am I doing wrong?


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md