How to detect if a Type is a generated DynamicProxy without referencing Castle DynamicProxy?

type.Assembly.FullName.StartsWith("DynamicProxyGenAssembly2")

You could make your dynamic type implements a specific interface:

public interface IDynamicProxy { }

...

ProxyGenerator generator = new ProxyGenerator();

var classProxy = generator.CreateClassProxy(typeof(Hashtable), new[] {typeof(IDynamicProxy)});
Debug.WriteLine(classProxy is IDynamicProxy);


var interfaceProxy = generator.CreateInterfaceProxyWithoutTarget(typeof(ICollection), new[] { typeof(IDynamicProxy) });
Debug.WriteLine(interfaceProxy is IDynamicProxy);