Understanding the various options for runtime code generation in C# (Roslyn, CodeDom, Linq Expressions, …?)
问题 I'm working on an application where I'd like to dynamically generate code for a numerical calculation (for performance). Doing this calculation as a data driven operation is too slow. To describe my requirements, consider this class: class Simulation { Dictionary<string, double> nodes; double t, dt; private void ProcessOneSample() { t += dt; // Expensive operation that computes the state of nodes at the current t. } public void Process(int N, IDictionary<string, double[]> Input, IDictionary