The other answers almost have it right. To load a type by name, you either need it's full name (if the assembly has already been loaded into the appdomain) or its Assembly Qualified name.
The full name is the type's name, including the namespace. You can get that by calling Type.GetType(typeof(System.ServiceModel.NetNamedPipeBinding).FullName)
. In your contrived example, this will work (since NetNamedPipeBinding
's assembly is assured to be loaded).
If you can't be sure it's loaded, use Sriram's answer, and pass a full assembly qualified name (TopNamespace.SubNameSpace.ContainingClass, MyAssembly). This will have .NET try to find and load htat assembly, then get the type.