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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:13:05+00:00 2026-06-14T03:13:05+00:00

I need to explain a bit to get to the problem. I have 3

  • 0

I need to explain a bit to get to the problem.

I have 3 projects:

Project 1 can see project 2 and 3.

Project 2 can see project 3.

Project 3 is a dll and the others are apps.

I had to design a class with a lot of subclasses. The subclasses all have a method which is declared as abstract in the base, so they all have to use it.
They need to get distributed in all projects, because the code in methode directly interacts with the project.

The abstract base classes are in Project 3, the subclasses are in 2 and 1.
There’s the problem I have:

This is the method I wrote:

   public static IEnumerable<Type> GetSubClasses(Type typ)
   {
       IEnumerable<Type> subclasses =
       from type in Assembly.GetAssembly(typ).GetTypes()
       where type.IsSubclassOf(typ) && !type.IsAbstract
       select type;
       return subclasses;
   }

I’m trying to get all subclasses of the type but when I do, I only get the subclasses from the current project. For example, if I try to get them from project1, I dont get the subclasses from project 2.

How do I do that? I know I can get an assembly reference from project 2 but it has no GetAssembly(Type t) method, with the help of that I’m getting all the subclasses.
If it would be the same I just had to do the same there.

My second question is, is there an easier way at all? It’s a bit..”large” having those classes in many projects, maybe there’s a solution to get them into one.
Like I said, the code of the methode they all need to have, needs to directly interact with the project they are in.

  • 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-06-14T03:13:06+00:00Added an answer on June 14, 2026 at 3:13 am

    The problem is you’re calling Assembly.GetTypes(). That gives you only the classes in that particualr assembly. If you have Assembly objects for all three assemblies, you can do something like

    assem1.GetTypes()
    .Concat(assem2.GetTypes())
    .Concat(assem3.GetTypes())
    

    So the problem is how you get the three Assembly objects. From project 1 you can just say

    var assem1 = typeof(SomeClassInProj1).Assembly;
    var assem2 = typeof(SomeClassInProj2).Assembly;
    var assem3 = typeof(SomeClassInProj3).Assembly;
    

    In a project where you can’t “see” the other assemblies, you need to load them. See the documentation of Assembly.Load.

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

Sidebar

Related Questions

Can someone please explain me why would a UDP Server not need to use
Here's an interesting one... hope I can explain it well... I have a collection
I need to explain myself why I do not use static methods/propertis. For example,
I need to explain this by example: Is there a best practice or preference
Let me explain: I need to sort a list in ascending order, while results
I need someone to explain the following names; Asynchronous Delegates. Asynchronous methods. Asynchronous events.
Hi I shall try to explain clearly what I need to be able to
I dont really know how to explain exactly what function i need but ill
It would take too long to explain why I need this, but I was
I need help on encryption/decryption on Android application. I explain the situation. I'm actually

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.