473,396 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Dynamically creating an object

Type codeDomProviderType =
Type.GetType("Microsoft.CSharp*.CSharpCodeProvider ", true);
ObjectHandle objHandle = Activator.CreateInstance(null,
"Microsoft.CSharp.CSharpCodePr*ovider");
Both lines of code throw exceptions when executed, neither one is able
to find the type in question. Am I on the right track? Or should I be
trying to create an instance of the provider a different way.
Example above is hard coded with the CSharpProvider for testing only,
eventually it will be read from a configuration file which one I want
to create.

Nov 16 '05 #1
4 1616
For assemblies in GAC you need to provide fully qualified name:

Type type = Type.GetType("Microsoft.CSharp.CSharpCodeProvider, system,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089,
Custom=null", true);

HTH,
Alexander

"ThisBytes5" <Th********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Type codeDomProviderType =
Type.GetType("Microsoft.CSharp*.CSharpCodeProvider ", true);
ObjectHandle objHandle = Activator.CreateInstance(null,
"Microsoft.CSharp.CSharpCodePr*ovider");
Both lines of code throw exceptions when executed, neither one is able
to find the type in question. Am I on the right track? Or should I be
trying to create an instance of the provider a different way.
Example above is hard coded with the CSharpProvider for testing only,
eventually it will be read from a configuration file which one I want
to create.
Nov 16 '05 #2
Thank you that did the trick.

Nov 16 '05 #3
Now that I look at the below a bit more, I have one more question.

Where does the custom come from? I've looked at the properties for
windows\assembly and have found everything else but the custom.

Alexander Shirshov wrote:
For assemblies in GAC you need to provide fully qualified name:

Type type = Type.GetType("Microsoft.CSharp.CSharpCodeProvider, system, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null", true);

HTH,
Alexander


Nov 16 '05 #4
No idea. I simply used "gacutil /l system" to get the full name.

HTH,
Alexander

"ThisBytes5" <Th********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Now that I look at the below a bit more, I have one more question.

Where does the custom come from? I've looked at the properties for
windows\assembly and have found everything else but the custom.

Alexander Shirshov wrote:
For assemblies in GAC you need to provide fully qualified name:

Type type = Type.GetType("Microsoft.CSharp.CSharpCodeProvider,

system,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089,

Custom=null", true);

HTH,
Alexander

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Eric | last post by:
How can I dynamically assign an event to an element? I have tried : (myelement is a text input) document.getElementById('myelement').onKeyUp = "myfnc(param1,param2,param3)"; ...
8
by: Falc2199 | last post by:
Hi, Does anyone know how to make this work? var sectionId = 5; repeat_section_sectionId(); function repeat_section_5(){ alert("firing"); }
6
by: Simon Verona | last post by:
I would normally use code such as : Dim Customer as new Customer Dim t as new threading.thread(AddressOf Customer.DisplayCustomer) Customer.CustomerId=MyCustomerId t.start Which would create...
7
by: pmclinn | last post by:
I was wondering if it is possible to dynamically create a structure. Something like this: public sub main sql = "Select Col1, Col2 from Table a" dim al as new arraylist al =...
3
by: Daniel Friend | last post by:
I have an application and use custom user controls as plugins. Is there any way to communicate back and forth from control to app. NOTE: The control is not refrenced in the app, it will act as a...
5
by: SalamElias | last post by:
I am creating several chkBoxes dynamically and assigning an event handler in the Page_load as foillows ***************************** Dim chkCatOption As CheckBox = New CheckBox chkCatOption.Text...
6
by: Bjorn Sagbakken | last post by:
Hello In VS2005: I am adding buttons and textboxes dynamically into a table, that also dynamically expands. So far, so good, actually very nice. But I am having trouble starting the desired...
6
by: RSH | last post by:
Hi, i have a situation where I need to dynamically create objects in a loop. My question surrounds intantiation naming in such a scenerio. Below is a snippet that is basically hardcoding each...
10
by: Jess | last post by:
Hello, If I create a temporary object using a dynamically created object's pointer, then when the temporary object is destroyed, will the dynamically created object be destroyed too? My guess...
4
by: mohaaron | last post by:
I can think of a lot of reasons why this might need to be done but as far as I can tell it's not possible. I've been looking for a way to add HtmlTableRows to a table using a button click for a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.