怎么安装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 ...
随机推荐
- 不难懂--------react笔记
在jsx中不能使用class定义类名 因为class在js中是用来定义类的 定义类名的时候用className label中的for必须写成htmlFor Rea ...
- mybatis配置入门中遇到的问题
问题一 非法注射 问题描述:WARNING: An illegal reflective access operation has occurred 这种问题主要是jdk版本和mybatis的jar包 ...
- kubernetes之手动部署k8s 1.14.1高可用集群
1. 架构信息 系统版本:CentOS 7.6 内核:3.10.0-957.el7.x86_64 Kubernetes: v1.14.1 Docker-ce: 18.09.5 推荐硬件配置:4核8G ...
- Vue3源码分析之微任务队列
参考资料:https://zh.javascript.info/microtask-queue#wei-ren-wu-dui-lie-microtaskqueue 简化版 Vue3 中的 微任务队列实 ...
- plsql 函数的定义 包规范和包主体。
/* 一.函数? 1.函数定义 函数的内容 根据实际需要来定义 2.使用的方式 */ -- 定义函数 根据部门编号查询出部门的总人数 create or replace function fn( de ...
- ApacheCN 计算机视觉译文集 20210218 更新
新增了六个教程: OpenCV3 安卓应用编程 零.前言 一.设置 OpenCV 二.使用相机帧 三.应用图像效果 四.识别和跟踪图像 五.将图像跟踪与 3D 渲染相结合 六.通过 JNI 混合 Ja ...
- MySQL 事务的隔离级别及锁操作的一点点演示
MySQL 版本:5.7 安装环境:MAC OS 一.测试数据 测试数据库:test:测试表:tt CREATE TABLE `tt` ( `id` int(11) DEFAULT NULL, `na ...
- IDE中集成widfly
第一步:添加JBOss服务器,Tomcat同理添加 第二步:选择刚刚部署好的服务器 第三步:启动服务: 注意:与Tomcat略有不同的是,启动的根目录可能不相同,导致一直404 查看启动的根目录: 注 ...
- 入门-k8s部署应用 (三)
Kubernetes 部署应用 在 k8s 上进行部署前,首先需要了解一个基本概念 Deployment Deployment 译名为 部署.在k8s中,通过发布 Deployment,可以创建应用程 ...
- Redis源码简要分析
转载请注明来源:https://www.cnblogs.com/hookjc/ 把所有服务端文件列出来,并且标示出其作用:adlist.c //双向链表ae.c //事件驱动ae_epoll.c // ...