# ExprBuilder **Repository Path**: acoloco/expr-builder ## Basic Information - **Project Name**: ExprBuilder - **Description**: 一个用来更方便地创建表达式树的工具。 - **Primary Language**: C# - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-08-21 - **Last Updated**: 2025-08-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: Csharp, expression, 表达式树 ## README # ExprBuilder #### 介绍 一个用来更方便地创建表达式树的工具。 #### 软件架构 共有五个文件: - ExprBuilder 最终使用的工具,它提供了各种基础的功能,如定义变量和If、循环等 - ExprBuilderExtensions 为ExprBuilder扩展了大量的方法 - ExpressionExtensions 为System.Expression扩展了大量的方法 - ExprBuilderUtility 一个作用不大的实用类 - BuilderVisitor 用于辅助解析执行表达式的工具 #### 环境要求 可能要求C#8.0及以上。使用到了以下命名空间: - using System; - using System.Collections.Generic; - using System.Linq.Expressions; - using System.Reflection; - using System.Buffers; - using System.Linq; #### 设计思路 1. 原先表达式树的创建很不直观,用创建方法的方式一步步组合起来 2. 变量和表达式分开管理 3. ExprBuilder中只包含核心功能,其他大量功能依靠扩展方法实现,保持纯净 #### 总结 所有的ExprBuilder都需要编译为委托之后才能使用。 #### 使用说明 可以参考[我的个人网站](https://www.shuibo.moe/note/841/)