Solved

getinstance in c#

Posted on 2006-07-12
5
4,358 Views
Last Modified: 2008-01-09
Hi,

I have convert the below java code into C# like the code given below i want to know whether it is ok or i have to do some other think?.


//Java code
Class c = Class.forName(module);
Object configObj = c.newInstance();


//C# code
System.Type c = System.Type.GetType(module);
System.Object configObj = System.Activator.CreateInstance(c);
0
Comment
Question by:Rahamathulla_J
  • 2
5 Comments
 
LVL 13

Expert Comment

by:devsolns
ID: 17090127
yeah, that is it.
0
 
LVL 3

Accepted Solution

by:
BBK_ earned 250 total points
ID: 17090430
System.Type.GetType will work only with the class which is available in System namespace

If it is in any your own assemble then you can load like
Assembly a = Assembly.LoadFrom(“c:\\test.dll”);
Type c = a.GetType (“test1”);

if you know the class then use
Type c =  typeof(Module);


0
 
LVL 13

Expert Comment

by:devsolns
ID: 17091695
yeah there are a lot of things like that you can point out but I dont see it being handled in java impl.
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

778 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