A new expression requires () or [] after type c# -


i'm using codedom compile following code , save exe

using system; using system.windows.forms; using microsoft.win32.taskscheduler;  class program { static void main(string[] args) {   using (taskservice ts = new taskservice())   {      taskdefinition td = ts.newtask();      td.registrationinfo.description = "does something";       // create trigger fire task @ time every other day      td.triggers.add(new dailytrigger { daysinterval = 1 });       // create action launch notepad whenever trigger fires      td.actions.add(new execaction("notepad.exe", "c:\\test.log", null));       // register task in root folder      ts.rootfolder.registertaskdefinition(@"test", td);       // remove task created      ts.rootfolder.deletetask("test");   } } } 

the problem when select save location , compile errro "a new expression requires () or [] after type". can't see i'm missing here, appreciated.

codedom uses c#2 compiler default, example not compile. compile c# 3 compiler can pass option provider on construction:

var csc = new csharpcodeprovider(new dictionary<string, string>() { { "compilerversion", "v3.5" } }); 

Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -