I'm trying to build a generic runtime C# expression evaluation engine to
allow the user to evaluate any C# code blocks at runtime within the
application's context. For example,
obj4.p4 = obj1.m1() + obj2.m2(p1, p2) - Class3.m3()
or
if (obj1.p1 > obj2.m2())
{
obj3.do()
}
where obj1, obj2 obj4 and Class3 are defined/instantiated in the application
domain. With the generic expression evaluation engine, the user can evaluate
any expressions allowed by the C# syntax and the methods and properties
supported by the defined classes in the application.
With C# Reflection capability, I can evaluate each operand, such as
obj1.m1(), obj2.m2(p1, p2), but I don't know how to evaluate expressions
with operators, such as +, -, *,etc which operates on two operands. I tried
to use Reflection.Emit, but I have to know the expression first to emit the
IL code, which is not possible because the user can write the expressions in
any forms.
C# debugger Watch window has the capability to allow users to input and
evaluate any supported expressions at runtime (at the breakpoints). I like
to have the similar capability but it is built into the application.
Thanks in advance for your help. 2 4262
There is a class Compiler in the Runtime that is able to compile c# code
into memory.
--
cody
Freeware Tools, Games and Humour http://www.deutronium.de.vu || http://www.deutronium.tk
"Jeffrey Ganping Chen" <je**********@enfocom.com> schrieb im Newsbeitrag
news:#e**************@TK2MSFTNGP12.phx.gbl... I'm trying to build a generic runtime C# expression evaluation engine to allow the user to evaluate any C# code blocks at runtime within the application's context. For example,
obj4.p4 = obj1.m1() + obj2.m2(p1, p2) - Class3.m3()
or
if (obj1.p1 > obj2.m2()) { obj3.do() }
where obj1, obj2 obj4 and Class3 are defined/instantiated in the
application domain. With the generic expression evaluation engine, the user can
evaluate any expressions allowed by the C# syntax and the methods and properties supported by the defined classes in the application.
With C# Reflection capability, I can evaluate each operand, such as obj1.m1(), obj2.m2(p1, p2), but I don't know how to evaluate expressions with operators, such as +, -, *,etc which operates on two operands. I
tried to use Reflection.Emit, but I have to know the expression first to emit
the IL code, which is not possible because the user can write the expressions
in any forms.
C# debugger Watch window has the capability to allow users to input and evaluate any supported expressions at runtime (at the breakpoints). I like to have the similar capability but it is built into the application.
Thanks in advance for your help.
http://msdn.microsoft.com/msdnmag/is...rApplications/
may be an option, if you don't mind using JScript.NET or VBScript.NET
instead.
Stu
"Jeffrey Ganping Chen" <je**********@enfocom.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... I'm trying to build a generic runtime C# expression evaluation engine to allow the user to evaluate any C# code blocks at runtime within the application's context. For example,
obj4.p4 = obj1.m1() + obj2.m2(p1, p2) - Class3.m3()
or
if (obj1.p1 > obj2.m2()) { obj3.do() }
where obj1, obj2 obj4 and Class3 are defined/instantiated in the
application domain. With the generic expression evaluation engine, the user can
evaluate any expressions allowed by the C# syntax and the methods and properties supported by the defined classes in the application.
With C# Reflection capability, I can evaluate each operand, such as obj1.m1(), obj2.m2(p1, p2), but I don't know how to evaluate expressions with operators, such as +, -, *,etc which operates on two operands. I
tried to use Reflection.Emit, but I have to know the expression first to emit
the IL code, which is not possible because the user can write the expressions
in any forms.
C# debugger Watch window has the capability to allow users to input and evaluate any supported expressions at runtime (at the breakpoints). I like to have the similar capability but it is built into the application.
Thanks in advance for your help.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Harry |
last post by:
Hi there,
does anyone know how I can build a regular expression e.g. for the
string.search() function on runtime, depending on the content of
variables? Should be something like this:
var...
|
by: Douglas Buchanan |
last post by:
I am using the following code instead of a very lengthly select case
statement.
(I have a lot of lookup tables in a settings form that are selected
from a ListBox. The data adapters are given a...
|
by: Brian Blais |
last post by:
Hello,
I have a string input from the user, and want to parse it to a number, and would like
to know how to do it. I would like to be able to accept arithmetic operations, like:
'5+5'...
|
by: leaf |
last post by:
How can i call arbirary functions at runtime, that with arbirary
parameters and types?
Can BOOST.Bind do that?
|
by: walter |
last post by:
Hi there, I figured that there must be someone knew this-- I'm looking for a
runtime expression evaluation engine for our business rule engine. A typical
case is passing in a expression at runtime ...
|
by: Licheng Fang |
last post by:
Basically, the problem is this:
'do'
Python's NFA regexp engine trys only the first option, and happily
rests on that. There's another example:
'oneself'
The Python regular expression...
|
by: Steven T. Hatton |
last post by:
I'm trying to improve my formal understanding of C++. One significant part
of that effort involves clarifying my understanding of the vocabulary used
to describe the language.
This is from the...
|
by: silpau |
last post by:
hi,
i am a bit confused on expression evaluation order in expressions
involving unary increment.decrement operators along with binary
operators.
For example in the following expression
x...
|
by: balabaster |
last post by:
I don't know if anyone's got any clue about this, but I have the following expression evaluator which makes use of the CodeDom to evaluate a VB.NET expression at runtime.
This gives the system...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |