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

The Archive Base Latest Questions

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

I have a problem with c# List, not sure where I’m missing the point

  • 0

I have a problem with c# List, not sure where I’m missing the point while adding a new object to the Managepagesid List!

 public class Clients
    {
        [BsonId]
        public string Id { get; set; } //Object ID managed by MongoDb

        public string Name { get; set; } //Client Name

        public string Phone { get; set; } //Client Phone

        public string Email { get; set; } //Client E-mail

        public string Username { get; set; } //Client Username

        public DateTime LastModified { get; set; } //Client Last Login

        public string FB_User_Id { get; set; } //Client FB User ID

        public AccessToken UserAccessToken { get; set; } //AccessToken which is stored while user is logged in.

        public List<ManagePages> Manage_Pages_id { get; set; } //The pages maintained by the specific client
     }

I’m trying to access add a new item into ManagePage_id list but its thrwing some null exception.. Help!

Clients client = new Clients();

            client.FB_User_Id = FBData.id;
            client.Name = FBData.name;
            client.Email = FBData.email;
            client.Username = FBData.username;

            for (int index = 0; index < FBData.accounts["data"].Count; index++)
            {
                ManagePages pagedetails = new ManagePages()
                {
                    page_id = FBData.accounts["data"][index].id,
                    page_name = FBData.accounts["data"][index].name,
                    ManagePages_AccessTokens = new AccessToken()
                    {
                        AccessToken_accessToken = FBData.accounts["data"][index].access_token,
                        AccessToken_expiryDate = DateTime.Now
                    },
                    ManagePages_category = FBData.accounts["data"][index].category
                };

                var category = pagedetails.ManagePages_category;

                client.Manage_Pages_id.Add(pagedetails);
            }

Stack Trace added!

Exception>System.NullReferenceExceptionObject reference not set to an instance of an object. at Vega_MongoDB.FBDataAccess.ClientFBRepository.ClientsData(String accessToken) in g:\Development\Vega_MongoDB\Vega_MongoDB\FBDataAccess\ClientFBRepository.cs:line 48
at Vega_MongoDB.Models.ClientRepository..ctor(String connection) in g:\Development\Vega_MongoDB\Vega_MongoDB\Models\Clients\ClientRepository.cs:line 47
at Vega_MongoDB.Models.ClientRepository..ctor() in g:\Development\Vega_MongoDB\Vega_MongoDB\Models\Clients\ClientRepository.cs:line 23
at Vega_MongoDB.Controllers.ClientsController..cctor() in g:\Development\Vega_MongoDB\Vega_MongoDB\Controllers\ClientsController.cs:line 18

And I have checked the pagedetails object, it contains all the data..

Thanks

Vishnu

  • 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-13T07:42:57+00:00Added an answer on June 13, 2026 at 7:42 am

    Try adding this to your class:

    public Clients()
    {
      this.Manage_Pages_id = new List<ManagePages>();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class like this public SomeClass { private List<string> _strings = new
I have a slight problem, and I'm not sure if i'm missing something here.
I have problem adding arraylist to list view, will explain about my problem here..
i have one problem with handling list,i have three class named as UserInf,userData,userProcess,i created
I have a problem either adding to or traversing a linked list. The main
I have a problem, and I'm not too sure how to solve it without
I have a small problem in my code, and im not sure how to
I have a problem. I get an error and I'm not sure why it's
I have the following problem I'm not sure how to address. I need to
I have a problem that I'm not sure how to go about solving. I

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.