Adam Lee
Adam Lee

Reputation: 25738

How to get type from some assembly?

say I have an assembly call B, inside B, there is a type called C

How to retrieve the type from C inside B.

Type.GetType seems can only get the type from the current or system assemblies?

Upvotes: 1

Views: 396

Answers (3)

Amit
Amit

Reputation: 1857

It is late but posting this as alternate way to do it.

Type type = Type.GetType("[Namespace].[ClassName], [AssemblyName]");

Upvotes: 0

doblak
doblak

Reputation: 3136

assemblyB.GetType(typeName);

you can inspect all assemblies in your domain:

var assemblies = AppDomain.CurrentDomain.GetAssemblies();

or target a speficic one

Upvotes: 1

gdoron
gdoron

Reputation: 150243

Use the b assembly:

bAssembly.GetType(ctype)

the ctype needs to be a string with Namespace + TypeName

See MSDN

Upvotes: 1

Related Questions