tags:

views:

49

answers:

1

Hey,

I'm new to using codedom.

Can someone tell me how to convert this code to be run in C#?

Code:

WebClient webClient = new WebClient();
webClient.DownloadFile("http://mysite.com/myfile.txt", @"c:\myfile.txt");

Thanks.

+1  A: 

A fully working CodeDom code sample is here:

http://msdn.microsoft.com/en-us/library/system.codedom.compiler.codedomprovider.aspx

Copy the code for CodeDomExample into a new class file (*.cs) and modify the CodeTypeReferenceExpression and the subsequent CodeMethodInvokeExpression instances to what you need.

code4life