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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:51:33+00:00 2026-06-17T02:51:33+00:00

i am trying to retrieve all the child elements but getting System.Collections.ListDictionaryInternal. Object reference

  • 0

i am trying to retrieve all the child elements but getting System.Collections.ListDictionaryInternal. Object reference not set to an instance of an object error.

my c# code retrieve all the question on according to the test_id and category_id passed:-

public static List<Questions> GetQuestion_Catgy(int test_id, int ctgy_id)
        {
            try
            {
                XDocument data = XDocument.Load(docurl);
                return (from exm in data.Descendants("test_details")
                        where exm.Attribute("id").Value.Equals(test_id.ToString())
                        from ctgy in exm.Descendants("category")
                        where ctgy.Attribute("id").Value.Equals(ctgy_id.ToString())
                        orderby (int)ctgy.Attribute("id")
                        select new Questions
                        {
                            quesID = Convert.ToInt32(ctgy.Attribute("id").Value),
                            quesSTRING = ctgy.Attribute("ques").Value,
                            quesRATE = Convert.ToInt32(ctgy.Attribute("rating").Value),
                            quesOPT1 = (string)ctgy.Element("opt1").Value,
                            quesOPT2 = (string)ctgy.Element("opt2").Value,
                            quesOPT3 = (string)ctgy.Element("opt3").Value,
                            quesOPT4 = (string)ctgy.Element("opt4").Value,
                            quesANS = Convert.ToInt32(ctgy.Element("ans").Value),
                            quesIMG = (string)ctgy.Element("img").Value
                        }).ToList();
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.Data + "\n" + ex.Message);
            }
        }

my xml

<test_details id="1" name="test exam" time="30" marks="100" difficulty="1">
    <category id="1" name="HTML">
      <question id="1" ques="what is HTML ?" rating="5">
        <opt1>Markup Language</opt1>
        <opt2>Scripting Language</opt2>
        <opt3>Server-Side Lanugae</opt3>
        <opt4>Client-Side Language</opt4>
        <ans>1</ans>
        <img>null</img>
      </question>
      <question id="2" ques="what is LMTH ?" rating="5">
        <opt1>Markup Language</opt1>
        <opt2>Scripting Language</opt2>
        <opt3>Server-Side Lanugae</opt3>
        <opt4>Client-Side Language</opt4>
        <ans>2</ans>
        <img>null</img>
      </question>
    </category>
    <category id="2" name="C#" />
  </test_details>

enter image description here

  • 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-17T02:51:35+00:00Added an answer on June 17, 2026 at 2:51 am

    It looks like you need to go down an extra level to the ‘question’ elements if you want to access the ques attribute. ctgy will not have ques.

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

Sidebar

Related Questions

I'm not the greatest with LINQ, but I'm trying to retrieve all the ModuleAvailabilities
I m trying to retrieve all the data in the isolated storage file. But
I'm trying to retrieve all children who are not parent. The table looks like
I am trying to retrieve all the certificates from windows-MY, but some of them
I'am trying to retrieve all site and subsite in sharepoint but i get access
Wordpress Experts, I am trying to retrieve all blogroll links in PHP array but
Im trying to retrieve all users from a domain, but I get an error..
I'm trying to retrieve all columns that start with any non alpha characters in
I'm trying to retrieve all documents in a folder in google docs using the
I'm trying to build a script to retrieve all feed entries from a given

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.