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
- Sorting a List by its property renames all the objects in the List
- Can't open new instance of another window in my app, in WPF .NET 8
- Binding forecolour and ToolTip to a DataGrid
- how to create Infinite Upgrades in a clicker game
- Try Catch exception is not catching the unhandled exception
- Assigning an object to another doesn't raise PropertyChanged event in WPF
- Masking input in TextBox
- What should I do if Visual Studio has a restriction on creating files with a long name or a long path to these files?
- reading configuration file (mytest.exe.config)
- WPF Windows Initializing is locking the separated thread in .Net 8
- How to bind to the DataContext ViewModel of another view?
- mouse coordinates in image go below 0 and above width
- WPF pop up is behaving differently in English language PC and Japanese language PC
- Multi level project reference using dll
- Unable to unzip archive .NET framework
Related Questions in EXTERNAL
- How do I add the Luxon library google sheet script
- C++. Ability to run executable file with external libraries on another pc
- How can I get the current time in gleam?
- what are the all bus types internal hard drives use?
- Problems with external .so libaries in nuget package
- After window.location.href, clicking on back button is not initializing the useState declared in the code
- Querying Redshift external table: "Could not find parent table for alias"
- Opus codec lib function not compiling in Qt Creator
- C# add listener to external API property
- Set up Acumatica Connector
- Loading only just table rows from external javascript file
- How can I get the previous URL in PHP?
- ESP32 best way to generate changeable frequency output on GPIO to drive external device
- Loading external .js file into Div from an onclick
- Load src javascript from file on click
Related Questions in FORMULA
- How to calculate the accuracy in number guessing game?
- Using arrayformula to automate sumif in each row, Google spresdsheet
- Formula assistance
- I am receiving a color formatting error when trying to run a Crystal Report in Personify
- Google Sheets: Return 1st, 2nd, 3rd, etc. instances of strings from range. Prepend values from top row to each string returned
- Gurobi unable to find the most optimal Link Utilization
- How do I return a certain date into a textbox based on a DateTimePicker date using VB.net Framework 8.0?
- Trying to get names from a box on the right to automatically appear in another box when a different box has a value in it
- PHP Spreadsheet modify one sheet without corrupting others
- Calculate an expression in java which is accurate upto 19 digits
- Filtering data by row Google sheets
- excel formula to find the first row that contains specific text
- Change cell colour of column data depending on stock availability in Google Sheets
- Excel formula to compare date/time and report if it is less than 24 hours
- Automatically change cell reference in formulas, based off of cell updating
Related Questions in RUNTIME-COMPILATION
- C# runtime compilation complains The type 'Object' is defined in an assembly that is not referenced
- Unable to get MetadataReference's for CSharpCompilation on .NET MAUI for Android
- CSharpCodeDomeProvider CS009: Metadata file could not be opened Metadata table InterfaceImpl not sorted
- Blocking operator==() at compile time
- Razor Pages only render when using RuntimeCompilation .NET 8 Preview 6
- java: java.lang.RuntimeException: java.io.IOException: in Intellij
- Unable to Access Types from Compiled WPF Project Loaded as DLL using Roslyn Compile
- How to runtime compile with reflection for a class being used within another class
- Missing dependency ‘object scala.native in compiler mirror’
- How to get the properties name, type and other info from a class gotton through CSharpCompilation.Create()?
- SQL Server errors out prematurely when starting a batch, for an error that will not actually occur
- How can I run generated code during script runtime?
- Asp.net MVC5 application Runtime compilation
- How to use function from my code in runtime-compiled code?
- Enable Runtime Compilation in ASP.Net RCL Project
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 # Hahtags
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.