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 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

class Foo(){ public List<string> SomeCollection; } I need to implement an event which can
class Foo { public int A { get; set; } } class Program {
I have a class Foo defined like this: class Foo { public: Foo(int num);
So I have an object the inherits a list. public class Foo: List<Bar> And
abstract class Foo { private List<Object> container; private bool update; Foo Foo() { container
Concerning data binding I have these classes: public class Foo : List<Bar> { public
I'm trying to populate a List of beans from a form: public class Foo
class foo { public: void say_type_name() { std::cout << typeid(this).name() << std::endl; } };
class Foo { public: void bar(); }; void Foo::bar() { static int n =
class Foo { public static IEnumerable<int> Range(int start, int end) { return Enumerable.Range(start, end);

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.