Solved

How to get all the assemblies information from the project

Posted on 2008-06-23
7
648 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 your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

705 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now