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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:57:50+00:00 2026-06-05T17:57:50+00:00

I have a dll in C# which returns a class object. DLL code: Person.cs:

  • 0

I have a dll in C# which returns a class object.

DLL code:

Person.cs:

namespace Extract
{
    public class Person
    {
        public string name;
        public string address;
        public int age;
        public int salary;
    }
}

Class1.cs

namespace Extract
{
    public class MClass
    {
        public static Person GetPerson()
        {
            Person p = new Person();
            p.name = "Deepak";
            p.address = "Bangalore";
            p.age = 30;
            p.salary = 20000;
            return p;
        }
    }
}

I have another program “RunApp” in C# which has the same Person.cs class and tries to get the object from the above dll.

RunApp Code:

Person.cs:

namespace Extract
{
    public class Person
    {
        public string name;
        public string address;
        public int age;
        public int salary;
    }
}

Form1.cs:

namespace Ex
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Person mem = MClass.GetPerson();
        }
    }
}

After this, when I compile the “RunApp” code, I get an Error:

“Cannot implicitly convert type ‘Extract.Person’ to ‘Ex.Person’ “. I
tried changing the namespace of the “RunApp” code from ‘Ex’ to
‘Extract’, but too the same Error: “Cannot implicitly convert type
‘Extract.Person’ to ‘Extract.Person’ “.

I want to send values from the Extract.dll to RunApp program. I want to use this dll at multiple programs.

Can anybody please help how to crack this problem?

  • 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-05T17:57:52+00:00Added an answer on June 5, 2026 at 5:57 pm

    A type is defined by its assembly. Two identical copies of Foo.Bar.SomeClass in two different assemblies are different types, and are not interchangeable – even if they have the same namespace etc.

    You should reference the library, and re-use the type from there.

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

Sidebar

Related Questions

I have a class in a dll which parses a file and returns a
I have a native/unmanaged DLL and it has a CreateObject function which returns a
I have a DLL which contains a class with static members . I use
I have a dll which I disassemble in Reflector, I then generate a class.
I have a dll called Test.dll in which I have a class called ABC
I have some code that references an outside DLL which in production will be
I have the following setup code: MockOf<IObjectSet<Dummy>>().Setup(c => c.AddObject(dummy)).Verifiable(); MockOf<IObjectContextWrapper>().Setup(c => c.GetObjectSet<Dummy>()).Returns(MockOf<IObjectSet<Dummy>>().Object); where Dummy
I have a DLL which provided a decoding function, as follows: function MyDecode (Source:
I have a C++ dll which implements several COM interfaces, that I'm trying to
I have a native DLL which outputs via stdout / stderr. I have a

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.