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\Visualizers

  • My 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.0 for debuggees running the .NET Framework runtime
  • netstandard2.0 for debuggees using a runtime that supports netstandard 2.0 (.NET Framework v4.6.1+ or .NET Core 2.0+).
  • netcoreapp for debuggees running the .NET Core runtime. (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的更多相关文章

  1. Visual Studio 2019 RC入门

    介绍 在本文中,让我们看看如何开始使用Visual Studio 2019 RC.Microsoft现已发布Visual Studio Release Candidate,现在可以下载了.最初,Mic ...

  2. Visual Studio 2019 RC

    Visual Studio 2019 RC入门 介绍 在本文中,让我们看看如何开始使用Visual Studio 2019 RC.Microsoft现已发布Visual Studio Release ...

  3. Visual Studio 2019 (VS2019)正式版安装 Ankh SVN和VisualSVN插件

    VS2019 正式版最近刚刚推出来,目前 Ankhsvn 还不支持,它最高只支持 VS2017,全网搜索了一下,也没有找到.在 Stackoverflow 上看了一下,找到这篇问答: 自己按照这种方法 ...

  4. Visual Studio 2019 (VS2019)正式版安装 VisualSVN Server 插件

    VS2019 正式版最近刚刚推出来,目前 Ankhsvn 还不支持,它最高只支持 VS2017,全网搜索了一下,也没有找到.在 Stackoverflow 上看了一下,找到这篇问答: 自己按照这种方法 ...

  5. 在Visual Studio 2019中安装Blend 4.5 SDK

    Visual Studio 2017安装时可以指定Blend SDK,到Visual Studio 2019时,安装时已经没有这个选项了. 官方提供的只有老版本4.0的安装包.要使用Blend SDK ...

  6. Visual Studio 2019 安装

    目录 写在前面 官网下载 安装 等待安装 启动 写在前面 目前工作的开发环境还是旧版本的Visual Studio 2013版.个人感觉还是有点跟不上时代更新迭代的节奏了.毕竟,技术在进步.如果我们也 ...

  7. OpenCV(c++)-1 安装和配置OpenCV4.4(Windows+visual studio 2019)

    @ 目录 安装OpenCV4 在Windows系统安装OpenCV4 配置visual studio 2019 配置包含路径 验证配置结果 安装OpenCV4 OpenCV是一个基于BSD许可(开源) ...

  8. visual studio 2019安装秘钥

    美国时间4.2微软发布了最新版本的visual studio 2019 现在贴出visual studio2019的秘钥,有需要的请自取: Visual Studio 2019 Enterprise( ...

  9. Visual Studio 2019 正式发布,重磅更新,支持live share

    如约而至,微软已于今天推出 Visual Studio 2019 正式版,一同发布的还有 Visual Studio 2019 for Mac. Visual Studio 2019 下载地址:htt ...

随机推荐

  1. CMake语法—普通变量与子目录(Normal Variable And Subdirectory)

    目录 CMake语法-普通变量与子目录(Normal Variable And Subdirectory) 1 CMake普通变量与子目录示例 1.1 代码目录结构 1.2 父目录CMakeLists ...

  2. JavaCV的摄像头实战之一:基础

    欢迎访问我的GitHub 这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos 关于<JavaCV的摄像头实战>系列 &l ...

  3. Servlet虚拟路径匹配规则

    当 Servlet 容器接收到请求后,容器会将请求的 URL 减去当前应用的上下文路径,使用剩余的字符串作为映射 URL 与 Servelt 虚拟路径进行匹配,匹配成功后将请求交给相应的 Servle ...

  4. 集合框架-ArrayList练习(去除ArrayList集合中的重复元素)

    1 package cn.itcast.p3.arraylist.test; 2 3 import java.util.ArrayList; 4 import java.util.Iterator; ...

  5. python3 爬取深圳主板公司名称,公司网址

    需要阅读的文档: Requests:http://cn.python-requests.org/zh_CN/latest/user/quickstart.html BeautifulSoup:http ...

  6. MySQL存储引擎(最全面的概括)

    目录 一:MySQL存储引擎 1.什么是存储引擎? 2.查看存储引擎信息 二:MySQL支持的存储引擎 1.存储引擎 三:innoDB存储引擎 1.特性 2.存储结构 3.优缺点.适用场景 四:MyI ...

  7. nginx 和uwsgi的区别与作用

    在介绍nginx和uwsgi的区别和作用之前我们先介绍一下几个概念 1.WSGI WSGI的全称是Web Server Gateway Interface(Web服务器网关接口),它不是服务器.pyt ...

  8. grafana ldap 权限无法保持

    一.Grafana介绍 Grafana是一个跨平台的开源的度量分析和可视化工具,可以通过将采集的数据查询然后可视化的展示,并及时通知.它主要有以下六大特点: 1.展示方式:快速灵活的客户端图表,面板插 ...

  9. 记一次 .NET 某智能交通后台服务 CPU爆高分析

    一:背景 1. 讲故事 前天有位朋友加微信求助他的程序出现了CPU爆高的问题,开局就是一个红包,把我吓懵了! 由于是南方小年,我在老家张罗处理起来不方便,没有第一时间帮他处理,朋友在第二天上午已经找出 ...

  10. 社交网络分析的 R 基础:(四)循环与并行

    前三章中列出的大多数示例代码都很短,并没有涉及到复杂的操作.从本章开始将会把前面介绍的数据结构组合起来,构成真正的程序.大部分程序是由条件语句和循环语句控制,R 语言中的条件语句(if-else)和 ...