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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:15:10+00:00 2026-05-23T23:15:10+00:00

class Foo { public List<object> mylist; public int num; public string name; public bool

  • 0
class Foo
{
    public List<object> mylist;

    public int num;
    public string name;
    public bool isIt;


    public Foo()
    { 
        mylist = new List<object>();
        mylist.Add(num);
        mylist.Add(name);
        mylist.Add(isIt);
    }
}


class Program
{
    static void Main(string[] args)
    {

        Foo my = new Foo();
        my.isIt = true;
        my.mylist[0] = 5;
        my.mylist[1] = "Hello";
        Console.WriteLine("" + my.mylist[2]);  => returns false instead of true
        Console.ReadLine();

    }
}
  • 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-23T23:15:11+00:00Added an answer on May 23, 2026 at 11:15 pm

    Assuming that your list will always have an item at index 2:

        private bool _isIt;
    
        public List<object> mylist;
    
        public bool isIt{
          get{return _isIt;}
          set{
             _isIt = value;
             myList[2] = value;
           }
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, suppose I have a class: class Foo { public: std::string& Name() {
class Foo { public List<Baz> bazs = new List<Baz> (); } class Baz {
Given the following class public class Foo { public int FooId { get; set;
Given a class like this: class Foo { public: Foo(int); Foo(const Foo&); Foo& operator=(int);
Let's say I have a class: class Foo { public string Bar { get
Suppose you have a collection of Foo classes: class Foo { public string Bar;
As an example: public class Foo { private Foo() {} } public class Bar
I have the simple class using auto-implemented properies: Public Class foo { public foo()
Let's say that I have a class Foo: public class Foo { public static
I have this class. public class Foo { public Guid Id { get; set;

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.