Get Argument Values From Linq Expression
2024-09-01 09:46:16
Get Argument Values From Linq Expression
If you even find yourself unpacking an expression in C#, you might find this useful. I found myself in need of obtaining a list of argument values from within an Expression<func> expression that sometimes had chained method calls. For example, I needed to be able to get the arguments from all of the following…
SomeMethod(() => getInformation.ForCustomer(CustomerId)); SomeMethod(() => MyFactory.GetInformation().ForCustomer(CustomerId)); SomeMethod(() => MyFactory.GetInformation().ForCustomer(CustomerId).ToList());
In the end, I created a couple of extension methods to help. One converts an expression into a MethodCallExpression (if that is a valid conversion), which is a type that has arguments. The second recursively searches for the arguments.
最新文章
- js点击按钮div显示,点击div或者body和按钮,div隐藏
- Java Spring-Spring与Quartz整合
- 一个update的小故事
- 【leetcode】Merge Intervals
- Hadoop3.0新特性介绍,比Spark快10倍的Hadoop3.0新特性
- SharePoint 2013 Nintex Workflow 工作流帮助(六)
- .Net调用非托管代码数据类型不一致的问题
- 获取月份对应的day
- 博客迁到CSDN
- Sql server统计查询语句消耗时间
- android生成apk包出现Unable to add &;quot;XXX&;quot; Zip add failed问题
- android--解--它们的定义tabhost(动态添加的选项+用自己的主动性横向滑动标签+手势切换标签页和内容特征)
- bzoj:1659: [Usaco2006 Mar]Lights Out 关灯
- Vigen&#232;re 密码
- ubuntu中使用docker部署.netcore2.1
- .net core 2.0 Code First Fluent API配置
- maven项目(多模块)
- Laravel 5.2 错误-----ReflectionException in compiled.php line 8572: Class App\Http\Controllers\Apih5\ZhaoshangController does not exist
- Linux安装rz/sz,htop插件
- CSS 小结笔记之浮动
热门文章
- 【vue&;ts开发】Vue 3.0前的 TypeScript 最佳入门实践
- javascript之位置
- 【异常】Maxwell异常 Exception in thread ";main"; net.sf.jsqlparser.parser.TokenMgrError: Lexical error at line 1, column 596. Encountered: <;EOF>; after : ";";
- Markdown 语法介绍
- jwt的原理以及使用
- react相关知识点总结
- Spring 整合 Quartz框架(定时任务)
- Linux命令的详解
- Vue.js-组件化前端开发新思路
- javax.persistence.TransactionRequiredException: Executing an update/delete query