I have been searching online for a neat way to compile code at runtime and manipulate the running application's objects (properties etc.). I have come across Snippy, CodeDom and CSharpCodeProvider but I didn't completely understood how I can use those solutions in my application to do what I want. Bottom line is, I want to have a small portion of the code in an external file so I can swap out different code during run time (e.g. Formulas to manipulate Data and etc.) Could somebody explain to me how exactly can I implement this in a WPF application in a neat fashion? I just need to pass the external code some data and after execution it will return me some data that I can populate an object with. P.S: I also thought about parsing Mathematical expression from String and manipulate my data that way but if I can parse and execute C# code externally at run time, it will give me much more freedom and control over the formula and data. Thanks in advance.
Compiling C# code from txt file to interface with running wpf application
1.4k Views Asked by Ling Xing At
1
There are 1 best solutions below
Related Questions in WPF
- WPF MessageBox Cancel checkbox check
- WPF multiple control property simultaneous changes
- ObservableCollection.CollectionChanged does not select the correct DataTemplate on ToolBar
- Telerik's WPF RadColorPicker NoColorText property not working
- How to automate UI interaction during acceptance test run
- Binding to "this.property" object in VisualStateMenager
- ContextMenu Closes Immediately
- Update ObservableCollection where the items are received from another List
- change content button with trigger
- WPF - How to highlight a combobox border when focused
- Wpf No Highlight on ListBoxItem for Touch Devices
- WPF WebBrowser how best to get Tag trees
- Make a class suitable for Property Change Notification
- WPF Comparing two datatables to find matching values
- how to create folder and file with datetime in wpf application
Related Questions in EXTERNAL
- Limit items on external list using BCS Filter
- Externalized filters when building a Maven project
- twisted logic: a global variable in one file refers to an extern variable but is also referred by that extern variable
- How to read a value on a specific line in an external file into an AWK script
- Curl post username/password to login
- Hive external table not showing partitions
- Open external application in own form
- external jquery mobile not implementing jquery mobile style
- Reading an external txt file on main.class
- JavaScript Only Image Hover
- Mad Mimi Error When Trying to Send Email to a List
- Mad Mimi Error when Trying to Send an e-mail to a list
- Updating a DIV inside a Collapsible in JQuery Mobile only when the Collapsible is opened (eg. load on demand)
- In general, how expensive is calling an external program?
- Writing to an External File on Android --- File Doesn't Register, But Java Can Read
Related Questions in FORMULA
- How can we decide the total no. of buckets for a hive table
- Unexpected Symbol in As Formula, Can't Find
- Excel formula for Bar-Code scanning old leased PCs to send back
- excel filter formula without v-lookup
- Converting letters to text and back again (Excel 2013)
- Formula in Excel - Logarithmic Average
- Find angle from two points formula
- Compare two columns and if match found check the next cell for a value and then return the result
- I would like to return a blank cell if referenced cells are blank
- Deconstruct Excel Formula To Get Result Without Trying Values
- Interpret formulae/operators as functions
- Counting values embedded in strings inside a column (Google Spreadsheets)
- Excel Help - How to delete duplicates from multipe columns
- Crystal report formula for time schedule based on day of week from the starting date
- Need to write a formula in JavaScript
Related Questions in RUNTIME-COMPILATION
- Create Class object from string containing source code
- passing class types to runtime compiled code C#
- Time complexity in ascending order
- Online c# interpreter security issues
- ToolProvider.getSystemJavaCompiler() returning null
- Making assemblies internals visible to another assembly at runtime
- Runtime compilation generates a file that can't be removed
- Runtime compiling DbContext with EF core, missing reference for Migrator()
- Add Embedded Resource to specific path from Assembly compiled at Runtime
- How to use function from my code in runtime-compiled code?
- Measuring memory use of a piece of code at runtime in Java as an on-going functionality of a service
- Loading external source code and using them internally (by re-compiling or something)
- Dependency inject a custom file provider for runtime compilation
- How to get the properties name, type and other info from a class gotton through CSharpCompilation.Create()?
- How to properly use include stdio.h in an NVRTC-compiled program?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I think you would do better using .NET compatible dynamic language like IronPython or IronRuby. Those integrate pretty much seamlessly with C#/.NET and are actually designed to provide execution-time scriptability.
Trivial example of IronPython usage from Jon Skeet's C# in Depth:
Needless to say, the scripts can use .NET Base Class Library and any extra methods you expose to them.