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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:57:31+00:00 2026-05-18T01:57:31+00:00

List<Object> testimonials = new List<Object>(); testimonials.Add(new { Author = Author 1, Testimonial = Testimonial

  • 0
List<Object> testimonials = new List<Object>();
testimonials.Add(new {
    Author = "Author 1",
    Testimonial = "Testimonial 1"
});
testimonials.Add(new {
    Author = "Author 2",
    Testimonial = "Testimonial 2"
});
testimonials.Add(new {
    Author = "Author 3",
    Testimonial = "Testimonial 3"
});

@ObjectInfo.Print(testimonials[DateTime.Now.DayOfYear % testimonials.Count].Author)

Gives me an error CS1061: ‘object’ does not contain a definition for ‘Author’

How do I get only the Author or Testimonial from the list of testimonials?

  • 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-18T01:57:31+00:00Added an answer on May 18, 2026 at 1:57 am

    A lazy way would be to switch “object” for “dynamic”. Or use A Tuple generic type.

    But IMO you should simply write a class with hear two properties:

    public class Testimonial {
        public string Author {get;set;}
        public string Comment {get;set;}
    }
    

    And use a List-of-Testimonial.

    Another way would be to use something like:

    var arr = new[]{new{...},new{...}};
    

    This is an array of your anon-type, and;

    string author = arr[0].Author;
    

    Would work fine.

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

Sidebar

Related Questions

I have List object filled with instances of a custom struct. list.Add(new Mail(mail1, test11,
Let's say I have a List object and an iterator for that list. Now
It seems that a List object cannot be stored in a List variable in
I have a List object being accessed by multiple threads. There is mostly one
Is there a way to convert a List(of Object) to a List(of String) in
What's the best way to keep a collection-object (List in example) in a Key/Value
I would like to know how I can refer to a list item object
Is it possible to iterate collection and list only filtered object information while debugging
I have an object that has a list of abstract 'aninamls'. i.e. var animals
I have a Request object which contains a list of Approvers. An approver has

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.