Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to get all the assemblies information from the project

Posted on 2008-06-23
7
652 Views
Last Modified: 2010-04-21
I want to create the instance of type that is present in another assembly by using reflection.can any body help me on how to create the instance that is present in another assembly....
0
Comment
Question by:mskeerthi
  • 3
  • 3
7 Comments
 
LVL 19

Expert Comment

by:elimesika
ID: 21844220
0
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 total points
ID: 21844340

Assembly assembly = Assembly.Load(System.IO.File.ReadAllBytes("FileName"));
            Type Type = assembly.GetType("MyType");
            object typeObject = Activator.CreateInstance(Type);

Open in new window

0
 

Author Comment

by:mskeerthi
ID: 21844408
when i am creating by using like this.in another project it is giving the error that

Error:Unable to cast object of type 'DfgClient.DfgService.InitDossierReq' to type 'DfgClient.DfgService.InitDossierReq'.

iam  doing the type casting like this:
 internal object InitDossier(object initrequest)
 {
             InitDossierReq request = (InitDossierReq)initrequest;
}

what can i do for this.
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 21844430
the likely casue would be that ur assembly versions are  different..
0
 

Author Closing Comment

by:mskeerthi
ID: 31469648
Excellent Solution for the problem
0
 

Author Comment

by:mskeerthi
ID: 21844613
I am trying to get the referenced assemblies by using reflection.but all my assembiles are not showing can anyone sent what will be reason ?
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 21844625
this will give u all the loaded assemblies

AppDomain.CurrentDomain.GetAssemblies();
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question