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

  • Home
  • SEARCH
  • 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 6070361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:55:29+00:00 2026-05-23T09:55:29+00:00

I start learning LINQ these days. I got an error when I try to

  • 0

I start learning LINQ these days. I got an error when I try to return an anonymous type in join query. And I don’t understand why I get this error.
Here is my coding.

List<Student> students = new List<Student>()
        {
            new Student{First="Svetlana",Last="Omelchenko",ID=111,Scores= new List<int>(){97,92,81,60}},
            new Student{First="Claire",Last="O'Donnell",ID =112,Scores=new List<int>(){75,84,91,39}},
            new Student{First ="Sven",Last="Mortensen",ID =113,Scores=new List<int>(){88,94,65,91}},
            new Student{First ="Cesar",Last="Garcia",ID=114,Scores=new List<int>(){97,89,85,82}}
        };

    List<ContactInfo> contactList = new List<ContactInfo>()
    {
        new ContactInfo{ID=111,Email="Contoso",Phone= "206-555-0108"},
        new ContactInfo{ID=112,Email="ClaireO@Contoso.com",Phone="206-555-0298"},
        new ContactInfo{ID=113,Email="SvenMort@Contoso.com",Phone="206-555-1130"},
        new ContactInfo{ID=114,Email="CesarGar@Contoso.com",Phone="206-555-0521"}
    };

var cInfo =
            from student in students
            where student.Scores.Average() > 85
            join ci in contactList on student.ID equals ci.ID
            select new { ci.Email, student.First };
        foreach (var c in cInfo)
            Console.WriteLine("{0)'s email is {1}", c.First, c.Email);

In the anonymous type, I get the email from contactList and student’s first name. I can not do like this ???

Thanks in advance.

Kevin

  • 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-05-23T09:55:30+00:00Added an answer on May 23, 2026 at 9:55 am

    You have a parenthesis instead of a curly bracket in your string format expression.

    "{0)'s email is {1}"
    

    should instead be

    "{0}'s email is {1}"
    

    . When I make this change, the output is:

    Cesar’s email is CesarGar@Contoso.com

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Where is a good place to start learning LINQ for .net, and what are
i start learning jquery few days ago, and i like it very much. but
I want to start learning OpenGL but I don't really want to have to
I want to start learning the machine language, you know the 0010011 type language.
i want to try learning GAEJ but i dont know where to start.. do
I want to start learning Ajax, but I don't know how to start to
Where should I start learning about version control systems? I've used SVN, Team Foundation,
I want to start learning HTML and AJAX using a Linux distribution. Can anyone
I'm about to start learning Ruby and would like a bit of reading material
I would like to start learning ASP.NET on a for-fun project. I'm hoping to

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.