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. golang中结构体的嵌套、方法的继承、方法的重写

    package main import "fmt" type human struct { name, phone string age int8 } type student s ...

  2. jdbc连接mysql数据库注意事项

    1.导入mysql驱动  http://blog.csdn.net/a153375250/article/details/50851049 2.开放机器访问权限 mysql>GRANT ALL ...

  3. 使用Hot Chocolate和.NET 6构建GraphQL应用(2) —— 实体相关功能实现

    系列导航 使用Hot Chocolate和.NET 6构建GraphQL应用文章索引 需求 在本文中,我们将会准备好用于实现GraphQL接口所依赖的底层数据,为下一篇文章具体实现GraphQL接口做 ...

  4. Python 调用 Shell

  5. 裸k8s搭建中遇到的两个坑

    在装docker的时候报错了,需要先安装selinux版本.才能安装容器. 需要按照提示安装这个包. 采用强制安装.rpm -ivh 包名字 --force --nodeps 在k8s的master上 ...

  6. shell脚本的分发,测试,查看

    #!/bin/bash for i in {2..64} do #远端复制文件或目录 rcp /test/cpuburn-in 10.1.1.$i:/test/ done #!/bin/bash fo ...

  7. 使用OpenFileDialog打开文件和使用FolderBrowserDialog选定文件夹

    选定文件夹 string foldPath = ""; FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog ...

  8. 使用JMX Exporter监控Rainbond上的Java应用

    场景 Prometheus 社区开发了 JMX Exporter 用于导出 JVM 的监控指标,以便使用 Prometheus 来采集监控数据.当您的 Java 应用部署在Rainbond上后 可通过 ...

  9. asp.net core 中的各种路径

    1.获取完整网址URL 方法一:先引用"using Microsoft.AspNetCore.Http.Extensions;",然后直接用"Request.GetDis ...

  10. winSCP上传文件到服务器失败,提示permission denied,返回码3

    1.查看sftp服务在你服务器的路径 cat /etc/ssh/sshd_config | grep sftp 2.在winSCP进行连接设置 设置好你的主机名.端口.用户名和密码,然后点击高级,点击 ...