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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:36:24+00:00 2026-05-11T01:36:24+00:00

I have ControlA which accepts an IInterfaceB which has a property of type List<unknownType>

  • 0

I have ControlA which accepts an IInterfaceB which has a property of type List<unknownType>

In an event of ControlA i need to add a new instance of unknownType to the List in IInterfaceB…

unknownType needs specific properties so i immediately thought it could be an interface, but quickly realised interfaces cannot be instantiated…

How would you design this system?

EDIT the current inheritance chain looks like this:

topLevelClass -> baseObject -> IBaseObject (which is implemented in topLevelClass) 

so if i added a new class to the chain it would need to do the inheriting and implementing which would be impossible (afaik)

  • 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. 2026-05-11T01:36:24+00:00Added an answer on May 11, 2026 at 1:36 am

    If I’m interpreting this correctly, you could add a constraint on unknownType to be of some interface that contains the properties you need:

    class ControlA {     void Frob<T>(IInterfaceB<T> something) where T : IHasSomeProperties, new()     {         something.ListOfT.Add(new T() { SomeProperty = 5 });         something.ListOfT.Add(new T() { SomeProperty = 14 });     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a control which has a button on it. All the button does
I have a control which is mounted within a form. I need to implement
I have a user control which is 2 RadCombos cascaded. I'm trying to add
I have a JQuery control which has some private methods. I would like to
I have an object which, although it has a text representation (i.e. could be
I have the following php pahe which accepts the user's first name and password
I have a controller which accepts public class MyModel { [MaxLength(400)] public string Message
I have a PHP page which accepts two variables <?php $formurl = listen.html ;
I have a dict, which I need to pass key/values as keyword arguments.. For
Have a gridview control which will show X amount of rows. I want to

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.