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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:26:25+00:00 2026-05-12T16:26:25+00:00

If I were to have interfaces like so: public interface IAlbum { string Title

  • 0

If I were to have interfaces like so:

public interface IAlbum
{
    string Title { get; set; }
}

public interface ITrack
{
    string Title { get; set; }
    float Duration { get; set; }
}

What would be the best way to add a list of tracks to the IAlbum interface? What if I wanted the individual tracks to be properties and not have an exposed array of tracks?

  • 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-12T16:26:25+00:00Added an answer on May 12, 2026 at 4:26 pm

    The list of tracks could be either:

    IList<ITrack> Tracks {get;}
    

    or

    IEnumerable<ITrack> Tracks {get;}
    

    If you want the concrete type to expose a more concrete API, you could implement the above via explicit implementation.

    You could in theory make:

    interface IAlbum : IEnumerable<ITrack> {...}
    

    but I don’t think that is a good idea.

    Re exposing tracks as properties; if I understand correctly, you could do this “kind of” at runtime by implementing ICustomTypeDescriptor on the concrete album type. But it is non-trivial and a bit messy – and it won’t help hugely unless you are using data-binding.

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

Sidebar

Related Questions

I have a class that implements multiple interfaces. I would like to register these
I have an interface that defines some methods I would like certain classes to
Does dot net have an interface like IEnumerable with a count property? I know
The (command line) interface I have in mind is like so: watching FILE+ do
I'd like to find all the types inheriting from a base/interface. Anyone have a
Let's say I have a class that implements the IDisposable interface. Something like this:
I have X interfaces to Y computers that communicate over a public network (Think
The title basically spells it out. What interfaces have you written that makes you
In c#, we have interfaces. Where did these come from? They didn't exist in
I have a small problem with interfaces. Here it is in Pseudo code :

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.