This site makes extensive use of JavaScript.
Please enable JavaScript in your browser.
Live
PTR
10.2.7
PTR
10.2.6
Beta
C# How to dynamically compile and load an assembly?
Post Reply
Return to board index
Post by
Wildhorn
Ok, i need to create a C# program (i use Visual Studio 2005) that will:
1) Take a string line in a .txt file and put it into a string variable (easy part)
2) That string is some executable code. Example: "if(true) { txtMyBox.Text = \"Yep\";}"
3) I need to compile that string code into an assembly when I click on a button
4) When I click on another button, it need to load that assembly code to execute if(true) { txtMyBox.Text = \"Yep\";}
Problem is, I dont know %^&* about assembly. So anybody who is skilled into that could help me?
So far what I got is:
using System.CodeDom.Compiler;
private void W_Compiler()
{
string W_MyCode = "if(true){txtMyBox.Text = \"Yep\";}"; //To simulate that text i get from the .txt
CodeDomProvider codeProvider = CodeDomProvider.CreateProvider("CSharp");
String
This is part of code I got on the web and I am more or less aware of what each of them does.
Thanks for any help :)
Post by
Wildhorn
I cant believe nobody is skilled into assembly... comon
Post by
84862
This post was from a user who has deleted their account.
Post by
Patty
OK...what the &*!@?
I was lost on the C#...I always thought that was a musical note >_<
Post by
123022
This post was from a user who has deleted their account.
Post by
Patty
That's 2 things. Mariah Carey's album and an equation in physics some things like "Energy = Mass x Speed of Light squared."
Post by
85162
This post was from a user who has deleted their account.
Post by
Patty
Well, look...Physics is the only science I'm not studying for A levels, so I'm not hugely bothered.
It bores me SO much...
Post by
85162
This post was from a user who has deleted their account.
Post by
Wildhorn
OK...what the &*!@?
I was lost on the C#...I always thought that was a musical note >_<
No, C# is a programming language like Visual Basic, Java, C++, etc
Post by
Patty
Ok, thanks for explaining wild....I'm sure it is something to do with music though and it's going to bug me until I find out what I am on about. :P
EDIT! I think I got confused with a C sharp >_<
Post by
240135
This post was from a user who has deleted their account.
Post by
Wildhorn
Ok, thanks for explaining wild....I'm sure it is something to do with music though and it's going to bug me until I find out what I am on about. :P
EDIT! I think I got confused with a C sharp >_<
C and # are also music symbols. C is for Mi and # is for half-a-note over.
Post by
170441
This post was from a user who has deleted their account.
Post by
Wildhorn
Stop to troll my thread damnit
Post by
170441
This post was from a user who has deleted their account.
Post by
276825
This post was from a user who has deleted their account.
Post by
9408
This post was from a user who has deleted their account.
Post Reply
You are not logged in. Please
log in
to post a reply or
register
if you don't already have an account.