Skip to content

Instantly share code, notes, and snippets.

@LinuxDoku
Created December 29, 2014 21:02
Show Gist options
  • Save LinuxDoku/9189cb01315e15f26c2a to your computer and use it in GitHub Desktop.
Save LinuxDoku/9189cb01315e15f26c2a to your computer and use it in GitHub Desktop.
Best guy when working with .NET remoting
using System;
namespace Residata.Platform.Server.Helper {
public static class AppDomainHelper {
public static T CreateInstanceAndUnwrap<T>(this AppDomain appDomain) {
return (T)appDomain.CreateInstanceAndUnwrap(typeof (T).Assembly.FullName, typeof (T).FullName);
}
}
}
@LinuxDoku
Copy link
Author

var applicationManager = someAppDomain.CreateInstanceAndUnwrap<ApplicationManager>();

instead of

var applicationManager = (ApplicationManager)someAppDomain.CreateInstanceAndUnwrap(typeof(ApplicationManager).Assembly.FullName, typeof(ApplicationManager).FullName);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment