Compile *.cs file during runtime and access member
<p>Is it possible to compile a cs file during run time so I can access it like a normal class?</p>

<p>In practice I read out a text file and store its information in a class structure. Afterwards I need to access class members within my application.</p>

<p>What I did by now: I compiled the cs file and created a dll using this example
<a href="http://msdn.microsoft.com/en-us/library/system.codedom.compiler.compilerparameters.generateexecutable.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.codedom.compiler.compilerparameters.generateexecutable.aspx</a></p>

<p>I changed it to:</p>

<pre><code>String exeName = String.Format(@"{0}\{1}.dll",
                System.Environment.CurrentDirectory,
                sourceFile.Name.Replace(".", "_"));

cp.GenerateExecutable = false;
cp.OutputAssembly = Name;
cp.GenerateInMemory = true;
cp.TreatWarningsAsErrors = false;
</code></pre>

<p>So what now?</p>

<p>edit:
will this help me:</p>

<pre><code>[DllImport("srec_struct_cs.dll", SetLastError = true)]
</code></pre>
