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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:51:36+00:00 2026-05-27T14:51:36+00:00

This is in AssemblyA namespace AssemblyA { public class ClassA { public static void

  • 0

This is in AssemblyA

namespace AssemblyA
{
    public class ClassA
    {
        public static void Main(string[] args)
        {
            ClassB b = new ClassB();
            Console.WriteLine(b.MultiplyTheSumByFactor(2, 3, 4));
            Console.ReadKey();
        }

        public int Multiply(int left, int right)
        {
            return left * right;
        }
    }
}

This is in AssemblyB

namespace AssemblyB
{
    public class ClassB
    {
        public int Sum(int left, int right)
        {
            return left + right;
        }

        public int MultiplyTheSumByFactor(int left, int right, int factor)
        {
            // ClassA a = new ClassA(); // can't reference AssemblyA
            int sum = Sum(left, right);
            Type type = Assembly.GetCallingAssembly().GetTypes().First();
            object a = Activator.CreateInstance(type);
            return (int)type.GetMethod("Multiply").Invoke(a, new object[] { sum, factor });
        }
    }
}

AssemblyA is a console application that references AssemblyB.

Why can’t I reference AssemblyA from AssemblyB, though I can load AssemblyA through
reflection and still call it’s methods?

Obviously there is virtually no reason for wanting to do this, I’m just curious as to how the compiler / CLR works in order to allow this to work through reflection.

  • 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-27T14:51:36+00:00Added an answer on May 27, 2026 at 2:51 pm

    Because compiling an assembly requires linking to it’s dependencies. If the dependencies for A are not yet compiled (because they reference A) you end up with a chicken and egg problem.

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

Sidebar

Related Questions

Consider the following: using System; using System.Dynamic; namespace DynamicTest { class Program { static
I have defined: [RdfSerializable] public class SomeItem { // Unique identificator of the resource
I have some questions about the following code: using System; namespace ConsoleApplication2 { public
Using Mono.Cecil I want to rewrite the following property: public string FirstName { get
Suppose I've a custom class (any class), with its methods and properties: public class
I need to do this:- MyClass.cs using System; using System.Collections.Generic; using System.Text; namespace set_property__Enum_To_Nullable_Enum
Interfaces (In the assembly named Interfaces. In project :- Interfaces) namespace Interfaces { public
I have a 32 bit .NET class library having a simple public class and
Full code: using System; using System.Linq; using System.Activities; using System.Activities.Statements; namespace ManyAssemblies { class
I have this: SolutionName: Foo.sln Assembly: Foo.Bar Namespaces are: Foo.Bar.Views Foo.Bar.Model Foo.Bar.BusinessObjects Foo.Bar.Services Should

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.