473,395 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Compiling and Calling C# on-the-fly

In my C# client-side application, I want to give the user
the ability to run algorithms that they write. Given the
rich features of VB and C# (and Java), I would like to
enable the user to write their algorithms in these
languages. My program should be able to interface to the
algorithm and run it on-the-fly. It should even let the
user debug their algorithms with .NET Visual Studio.

Has anyone done this? Is their a good guide, book, or
tutorial that would explain what would be necessary?

Thanks!
Nov 15 '05 #1
3 2180
I've done something like that in the following article:
http://www.microsoft.com/belux/nl/ms.../datagrid.mspx
The first problem that needs to be solved is: how can we evaluate
expressions, which are stored in a string value at runtime? The first
thought could be: we have to build an interpreter that splits the string
into pieces that we can execute one by one. But this approach would be quite
difficult to build, especially if you want to support a lot of functions.
For example imagine to support ToString, Length, ToUpper, ... But luckily
there is the CodeDom in the .NET Framework that is just what we need!
CodeDom stands for Code Document Object Model, and like what an XMLDocument
is for XML, the CodeDom is for code. With the CodeDom you can describe code
in an object oriented way, like an XMLDocument is a way to describe XML in
an object oriented way. Each code structure has its own class in the
CodeDom, so it's possible to build language-independent code at run-time.
That's right, CodeDom is language-independent, and if you think about it,
it's quite normal: each language has its If-Then, For-Each, ... structures.
Once you have a built code with the CodeDom you can do two things with it:
code generation or compilation. Because the CodeDom is language independent
it's quite easy to generate code for any language. But code compilation is
what we need, we want to be able to execute an expression and get the return
value.
--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Chris" <an*******@discussions.microsoft.com> schreef in bericht
news:09****************************@phx.gbl...
In my C# client-side application, I want to give the user
the ability to run algorithms that they write. Given the
rich features of VB and C# (and Java), I would like to
enable the user to write their algorithms in these
languages. My program should be able to interface to the
algorithm and run it on-the-fly. It should even let the
user debug their algorithms with .NET Visual Studio.

Has anyone done this? Is their a good guide, book, or
tutorial that would explain what would be necessary?

Thanks!

Nov 15 '05 #2
http://msdn.microsoft.com/library/en...asp?frame=true

-Rob Teixeira [MVP]

"Chris" <an*******@discussions.microsoft.com> wrote in message
news:09****************************@phx.gbl...
In my C# client-side application, I want to give the user
the ability to run algorithms that they write. Given the
rich features of VB and C# (and Java), I would like to
enable the user to write their algorithms in these
languages. My program should be able to interface to the
algorithm and run it on-the-fly. It should even let the
user debug their algorithms with .NET Visual Studio.

Has anyone done this? Is their a good guide, book, or
tutorial that would explain what would be necessary?

Thanks!

Nov 15 '05 #3
I meant to include this link too:

http://msdn.microsoft.com/library/de...ng06112001.asp

-Rob Teixeira [MVP]

"Chris" <an*******@discussions.microsoft.com> wrote in message
news:09****************************@phx.gbl...
In my C# client-side application, I want to give the user
the ability to run algorithms that they write. Given the
rich features of VB and C# (and Java), I would like to
enable the user to write their algorithms in these
languages. My program should be able to interface to the
algorithm and run it on-the-fly. It should even let the
user debug their algorithms with .NET Visual Studio.

Has anyone done this? Is their a good guide, book, or
tutorial that would explain what would be necessary?

Thanks!

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Luca | last post by:
Hi all. I've a problem compiling PHP (both 4.3.6 and 5 rc2) with ldap support (--with-ldap). "configure" doesn't return any error, but when I launch "make" it returns: grep:...
1
by: mazu | last post by:
I get errors about QAssistantClient while compiling PyQt 3.7, on my debian woody with Qt 3.1.2. Here is compiler message: cd qt && /usr/bin/make -f Makefile make: Entering directory...
4
by: Fred Mailhot | last post by:
Hi... Is there any way to do this for *nix ?? Pointers to resources and/or FAQS would be much appreciated. Thanks, Fred.
5
by: Bruce Lee Roy | last post by:
Hi, I am using visual studio.net and I am having problems using this bit of code when I create an instance, //////////////////////////////////////////// template<class T> class matrix : public...
10
by: Roberto Modica | last post by:
Hi all, I am trying to create a namespace hierachy but i think i am doing something wrong. I have an DAL vb file with the namespace: CompanyName.newsletter.DAL and i compile that using...
0
by: dmg | last post by:
is there a recommended practice for deploying .net web applications? we use a command line compiling method and seem to be running into issues with conflicting assemblies... especially in those...
0
by: mjm | last post by:
Hi, My script errors when compiling with: SCRIPT: Compiling Error => Line 59 : Expected statement (-2146827264) 'Variables available on this screen can be declared and initialized here. Dim...
3
by: Russ | last post by:
Is it possible to compile python code into a library (on unix), then link to it and call it from C/C++? If so, where can I learn how. Thanks.
1
by: drajesh | last post by:
hi all, I had a code which is compiling fine on VC++ 6.0 ..but on compiling same code in VS 2005 i m facing following error. error C2678: binary '!=' : no operator found which takes a left-hand...
5
by: Andrus | last post by:
How to compile source code into dynamic method ? System.Reflection.Emit.DynamicMethod requires IL code for creation. How to use C# source code to create method instead of manually creating IL...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.