?
Solved

How to get all the assemblies information from the project

Posted on 2008-06-23
7
Medium Priority
?
655 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
[X]
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
  • 3
  • 3
7 Comments
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 2000 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

764 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