Reputation: 15275
I want to use the API presented in this page however I've done this before. What is the equivalent of something like the code below in C#?
var vc = new ActiveXObject("NetLimiter.VirtualClient");
Upvotes: 0
Views: 904
Reputation: 1039368
Type type = Type.GetTypeFromProgID("NetLimiter.VirtualClient", true);
object vc = Activator.CreateInstance(type);
But then in order to use it, unless you use the C# 4.0 dynamic keyword, a reflection inferno is awaiting you.
If you want to generate a strongly typed COM wrapper you could use the "Add Reference" dialog and select the COM object from the COM tab. Then you can consume this ActiveX object as any standard .NET type - in a strongly typed manner.
Upvotes: 3