views:

133

answers:

1

I've been writing applications that load xaml files dynamically using XamlReader. That way I can skin my applications in different ways, or distribute just simple xaml files to users for different amounts of functionality. Now I'm wondering if there's a way to do something similar for code-behind files. Is there a way to distribute a loose code behind file as an external file that can be dynamically loaded? I imagine no because it's code, but I thought I'd ask anyway :)

Thanks!

+1  A: 

Yes, there is. You can reference the C# compiler and use it to compile files dynamically. Check out the CSharpCodeProvider class.

Charlie