怎么安装ExpressionTreeVisualizer for Visual Studio 2019
1、下载 ExpressionTreeVisualizer https://github.com/zspitz/ExpressionTreeVisualizer/releases , 解压后把相应dll文件拷贝相应的目录
2、拷贝到以下路径之中的任何一个。
sualStudioInstallPath
\Common7\Packages\Debugger\Visualizers(这个是路径模板格式) 例如:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Packages\Debugger\VisualizersMy Documents\VisualStudioVersion\Visualizers(这个是路径模板格式)
3、拷贝到以下路径之中的任何一个。
VisualStudioInstallPath
\Common7\Packages\Debugger\Visualizers\Framework例如:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Packages\Debugger\Visualizers\Framework
My Documents\VisualStudioVersion\Visualizers\Framework
where Framework is either:
net2.0for debuggees running the.NET Frameworkruntimenetstandard2.0for debuggees using a runtime that supportsnetstandard 2.0(.NET Framework v4.6.1+or.NET Core 2.0+).netcoreappfor debuggees running the.NET Coreruntime. (supports.NET Core 2.0+)(我是用这个框架我就拷贝这个框架下面)
测试案例:
大幅度反对法
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection; namespace TestVisualizer
{
class Program
{
static void Main(string[] args)
{ List<PeopleCopy> peoleCopyList = new List<PeopleCopy>();
for (int i = 0; i < 5; i++)
{
People people = new People() { Id = 5 + 1, Age = 25, Name = "aaa" + i };
peoleCopyList.Add(ExpressionTree.TransExp<People, PeopleCopy>(people));
}
foreach (var item in peoleCopyList)
{
Console.WriteLine(item);
}
Console.Read(); }
}
public class People
{
public int Age { get; set; }
public string Name { get; set; } public int Id; } public class PeopleCopy
{
public int Age { get; set; }
public string Name { get; set; } public int Id; public override string ToString()
{
return "Age=" + Age + ";Name=" + Name + ";Id=" + Id;
}
}
public class ExpressionTree
{ private static Dictionary<string, object> _Dic = new Dictionary<string, object>();
public static TOut TransExp<TIn, TOut>(TIn tIn)
{
string key = $"funckey_{typeof(TIn).FullName}_{typeof(TOut).FullName}";
if (!_Dic.Keys.Contains(key))
{
ParameterExpression parameterExpression = Expression.Parameter(typeof(TIn), "p");
List<MemberBinding> memberBindingList = new List<MemberBinding>();
foreach (var item in typeof(TOut).GetProperties())
{
PropertyInfo propertyInfo = typeof(TIn).GetProperty(item.Name);
if (propertyInfo == null) { continue; }
MemberExpression property = Expression.Property(parameterExpression, propertyInfo);
memberBindingList.Add(Expression.Bind(item, property));
}
foreach (var item in typeof(TOut).GetFields())
{
FieldInfo fieldInfo = typeof(TIn).GetField(item.Name);
if (fieldInfo == null) { continue; }
MemberExpression property = Expression.Field(parameterExpression, fieldInfo);
memberBindingList.Add(Expression.Bind(item, property));
}
Expression<Func<TIn, TOut>> expression = Expression.Lambda<Func<TIn, TOut>>(Expression.MemberInit(Expression.New(typeof(TOut)), memberBindingList), new ParameterExpression[]
{
parameterExpression
});
Func<TIn, TOut> func = expression.Compile();
_Dic.Add(key, func);
}
return ((Func<TIn, TOut>)_Dic[key])(tIn);
} } }
怎么安装ExpressionTreeVisualizer for Visual Studio 2019的更多相关文章
- Visual Studio 2019 RC入门
介绍 在本文中,让我们看看如何开始使用Visual Studio 2019 RC.Microsoft现已发布Visual Studio Release Candidate,现在可以下载了.最初,Mic ...
- Visual Studio 2019 RC
Visual Studio 2019 RC入门 介绍 在本文中,让我们看看如何开始使用Visual Studio 2019 RC.Microsoft现已发布Visual Studio Release ...
- Visual Studio 2019 (VS2019)正式版安装 Ankh SVN和VisualSVN插件
VS2019 正式版最近刚刚推出来,目前 Ankhsvn 还不支持,它最高只支持 VS2017,全网搜索了一下,也没有找到.在 Stackoverflow 上看了一下,找到这篇问答: 自己按照这种方法 ...
- Visual Studio 2019 (VS2019)正式版安装 VisualSVN Server 插件
VS2019 正式版最近刚刚推出来,目前 Ankhsvn 还不支持,它最高只支持 VS2017,全网搜索了一下,也没有找到.在 Stackoverflow 上看了一下,找到这篇问答: 自己按照这种方法 ...
- 在Visual Studio 2019中安装Blend 4.5 SDK
Visual Studio 2017安装时可以指定Blend SDK,到Visual Studio 2019时,安装时已经没有这个选项了. 官方提供的只有老版本4.0的安装包.要使用Blend SDK ...
- Visual Studio 2019 安装
目录 写在前面 官网下载 安装 等待安装 启动 写在前面 目前工作的开发环境还是旧版本的Visual Studio 2013版.个人感觉还是有点跟不上时代更新迭代的节奏了.毕竟,技术在进步.如果我们也 ...
- OpenCV(c++)-1 安装和配置OpenCV4.4(Windows+visual studio 2019)
@ 目录 安装OpenCV4 在Windows系统安装OpenCV4 配置visual studio 2019 配置包含路径 验证配置结果 安装OpenCV4 OpenCV是一个基于BSD许可(开源) ...
- visual studio 2019安装秘钥
美国时间4.2微软发布了最新版本的visual studio 2019 现在贴出visual studio2019的秘钥,有需要的请自取: Visual Studio 2019 Enterprise( ...
- Visual Studio 2019 正式发布,重磅更新,支持live share
如约而至,微软已于今天推出 Visual Studio 2019 正式版,一同发布的还有 Visual Studio 2019 for Mac. Visual Studio 2019 下载地址:htt ...
随机推荐
- zabbix表达式
system.cpu.load[all,avg1].min(10)}>2 load连续10分钟>2 system.cpu.load[percpu,avg1].count(#3,0.6,&q ...
- Typora破解
Typora破解 需要python环境,没有的话需要先安装一下 访问 https://github.com/Mas0nShi/typoraCracker.git下载下来破解需要的压缩包并且解压缩 或者 ...
- find -or 用法
find /opt/IBM/WebSphere85/ -name *loggeter* - or -name *loggetter* | xargs rm -rf
- shiro 框架之 加密处理。
一.shiro 加密? /* Shiro? 一.为什么要加密? 为调高数据库的安全性,需要给密码加密. 二.常见的加密算法? 1.1哈希算法 md5:加密算法 哈希函数 1.2.对称算法 1.3.非对 ...
- c++14新特性
1.函数返回值类型推导 c++14对函数返回类型推导规则做了优化: auto func(int i) { //C++11编译非法,c++14支持auto返回值类型推导 return i; } int ...
- C# 实例解释面向对象编程中的单一功能原则
在面向对象编程中,SOLID 是五个设计原则的首字母缩写,旨在使软件设计更易于理解.灵活和可维护.这些原则是由美国软件工程师和讲师罗伯特·C·马丁(Robert Cecil Martin)提出的许多原 ...
- 错误代码 insufficient-isv-permissions 错误原因: ISV权限不足
前言 PC网页吊起支付宝支付界面报了如下这么个错误: 我明明申请的支付宝支付功能列表的签约已经生效了呀!怎么回事呢? 解决 支付宝商户中心:https://b.alipay.com/signing/p ...
- 分布式系统及CAP理论
一.集中式系统 在学习分布式之前,先了解一下与之相对应的集中式系统是什么样的. 集中式系统用一句话概括就是:一个主机带多个终端.终端没有数据处理能力,仅负责数据的录入和输出.而运算.存储等全部在主机上 ...
- Media Player播放
转载请注明来源:https://www.cnblogs.com/hookjc/ <object id="player" height="64" width ...
- Servlet中@WebServlet属性详解
感谢原文作者:想当一只小小攻城狮 原文链接:https://blog.csdn.net/weixin_45493751/article/details/100559683 在Servlet中,设置了@ ...