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 8775023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:42:29+00:00 2026-06-13T18:42:29+00:00

I have this snippet. List<Frames> FrameList; where Frames is a class containing only primitives

  • 0

I have this snippet.

List<Frames> FrameList;

where Frames is a class containing only primitives including a string field “ExerciseID”.

...


void GetFramesForExercise(string exerciseID)

    ....

    if (exerciseID == "3.2.2") { 
       Console.Write(""); }  // quick and dirty to add a breakpoint

    if (FramesList[115].ExerciseID.Equals(exerciseID)) { 
       Console.Write(""); } // quick and dirty to add a breakpoint

    frames = (Frames)FramesList.Single(r => r.ExerciseID.Equals(exerciseID));

By putting breakpoints on the console.write statements, I am able to see that exerciseID does indeed equal “3.2.2” and that FramesList[115] points to an instance of Exercise with ID equal to “3.2.2”. The instance pointed to is correctly initiliased.

Why does my query throw an InvalidOperationException?

  • 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-13T18:42:30+00:00Added an answer on June 13, 2026 at 6:42 pm

    If there are more than one matching elements, Single will throw an InvalidOperationException. (As you’ve checked there is at least one that matches, this is the only reason I can see that you’d get this exception.)

    See the Exceptions section of this page.

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

Sidebar

Related Questions

I have this snippet of the code: void addLineRelative(LineNumber number, LineNumber relativeNumber) { list<shared_ptr<Line>
i have this code snippet private List<string> FolderOne(string Folder) { string filena; DirectoryInfo dir
I have this snippet of Scala code: def prologList(l: List[ScalaObject], sep: String) = [
I have this code snippet import java.util.ArrayList; import java.util.List; public class AssertTest { public
I have this snippet of code: template<typename... Args> class function_helper<void(Args...)>{ public: typedef void(*generic_function)(Args...); static
I have this snippet of code private Templates retrieveFromCache(String name) { TemplatesWrapper t =
i have this snippet of code that use an iterator on a list for
I have this snippet of the code account.cpp #include account.h #include <iostream> #include <string>
I have this handy snippet [see below] that truncates a set of list items
So i have this code, the snippet is given below. list* init(list* list1) {

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.