you could either look up c# parser and lexer codes, and tweak to your needs.
Maybe look at Mono's c# compiler.
that is however non trivial work.

you can also wrap the text with a valid c# class and method declarations,
then use a CodeDomProvider.CompileAssemblyFromSource() to get an assembly,
lookup your new type, and invoke the new method.


On Fri, Mar 5, 2010 at 9:23 PM, CassioT <[email protected]> wrote:

> Hi all. This is an NH off topic but it is C# and programming anyway.
>
> Let's suppose:
>
> var blog = dao.GetBlog(1); //Blog has posts
>
> string s = "blog.Posts.Sum(p => p.NumOfVisitors)";
>
> or
>
> string s = "Posts.Sum(p => p.NumOfVisitors)"; // considering blog as
> the root object
>
> What is the best way to translate this string in code dynamically?
> This is only a simple example but it is near of what I want.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>


-- 
Ken Egozi.
http://www.kenegozi.com/blog
http://www.delver.com
http://www.musicglue.com
http://www.castleproject.org
http://www.idcc.co.il - הכנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to