linq

Github上优秀的.NET Core项目

北战南征 提交于 2020-08-11 01:11:44
Github上优秀的.NET Core开源项目的集合。内容包括:库、工具、框架、模板引擎、身份认证、数据库、ORM框架、图片处理、文本处理、机器学习、日志、代码分析、教程等。 Github地址: https://github.com/jasonhua95/awesome-dotnet-core , 【awesome-dotnet-core】 其中的翻译有可能有问题,大家发现了及时提出来,其他的比较好的项目也可以提出来,我会及时添加修改上去的。 一般 ASP.NET Core Documentation - 官方ASP.NET核心文档站点。 .NET Core Documentation - .NET Core,C#,F#和Visual Basic技术文档的主页,包括基本概念,入门说明,教程和示例。 .NET Core SDK - .NET Core SDK是由Microsoft和.NET社区在 GitHub 上维护的通用开发平台。 .NET Platform Standard - 旧版本和新版本的.NET之间存在差异。 Introducing .NET Standard 2.0 - 介绍.NET Standard 2.0的内容和当前.NET标准中某些缺失部分的路线图。 .NET/.NET Core代码整洁 - 适用于.NET / .NET Core的代码整洁。 .NET

.net mvc(一)将数据库提取出来显示在网页

孤街浪徒 提交于 2020-08-10 23:48:55
默认已经连接数据库,数据库实体名称是:MusicStoreBD.cs 一、实例化数据库 ①在项目文件夹下的Controller中创建新控制器MusicStore(可选操作) ②实例化:MusicStoreBD ms = new MusicStoreBD(); MusicStoreBD ms = new MusicStoreBD(); 二、添加操作 ①提取数据 ②显示数据 public ActionResult Index() { var musiclist = from i in ms.MusicInfo select i; // LinQ语句,从数据库中提取数据 // MusicInfo是一张表 return View(musiclist.ToList()); // 执行ToList()操作,列表 } 注:MusicStore控制器的完整代码 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MusicStore.Models; namespace MusicStore.Controllers { public class StoreController : Controller { // GET:

C# winform程序怎么打包成安装项目(图解)

走远了吗. 提交于 2020-08-10 23:32:49
C# winform程序怎么打包成安装项目(图解) 开发环境:VS2010+SQL Server 2008 操作系统:win7_32bit 旗舰版 开发语言:C# 项目名称:学生寄宿管理系统 下面开始介绍:如何给windows应用程序打包? 第一步: 打开VS2010,打开你要打包的项目,然后右击"解决方案",”添加“,"新建项目",弹出如下图所示界面: 点击”安装和部署“左边的三角形,选择下面的”Visual studio Installer“,再选择”安装项目“,同时将下面的命名改为”Setup“点击确定。 第二步: 点击解决方案里面生成的”Setup“,将属性中的ProtectName改为”学生寄宿系统 V1.0 “(你的项目名字) 第三步: 右击解决方案里面的”Setup“,然后再选择”属性“。弹出属性页界面如下第二张图: 再点击里面的系统必备。 重要一点:勾选"从与我的应用程序相同的位置下载系统必备组件(D)",其实意思就是说你勾选后,生成安装项目时,在你安装项目的路径下,会有你在系统必备组件列表中勾选的组件.(系统自动完成,这一点还不错,不需要你自己去下载组件) 1)、Windows Installer 3.1(必选) 2)、.NET Framework 3.5 (可选)参考最后说明 3)、Crystal Report Basic for Visual

Select and sum DataTable rows with criteria

守給你的承諾、 提交于 2020-08-10 19:16:34
问题 I have this data table: DataTable dt = new DataTable(); dt.Columns.Add("BBG IPC code", typeof(double)); dt.Columns.Add("Issuer Group", typeof(string)); dt.Columns.Add("Seniority", typeof(string)); dt.Columns.Add("Nom Value", typeof(double)); dt.Columns.Add("Mkt Value", typeof(double)); dt.Columns.Add("Rating", typeof(string)); dt.Columns.Add("Sector", typeof(string)); dt.Columns.Add("Analyst", typeof(string)); dt.Rows.Add(new object[] { 117896, "Financiere", "Senior", 101, 20000.76, "BB",

Select and sum DataTable rows with criteria

霸气de小男生 提交于 2020-08-10 19:16:16
问题 I have this data table: DataTable dt = new DataTable(); dt.Columns.Add("BBG IPC code", typeof(double)); dt.Columns.Add("Issuer Group", typeof(string)); dt.Columns.Add("Seniority", typeof(string)); dt.Columns.Add("Nom Value", typeof(double)); dt.Columns.Add("Mkt Value", typeof(double)); dt.Columns.Add("Rating", typeof(string)); dt.Columns.Add("Sector", typeof(string)); dt.Columns.Add("Analyst", typeof(string)); dt.Rows.Add(new object[] { 117896, "Financiere", "Senior", 101, 20000.76, "BB",

Comparing two lists and removing each item that contains an entry from the other list

半世苍凉 提交于 2020-08-10 19:06:17
问题 I'm trying to essentially copy any list items in fileManifest but only those that don't contain in any of the items from exclusionFilters to a newly initialized list. I haven't figured out an elegant way to do this other than a nested foreach loop. Does someone by chance have a better solution for this problem? Maybe LINQ ? var fileManifest = new List<string>() { @"C:\Test\Directory1\File1.xml", @"C:\Test\Directory1\File2.xml", @"C:\Test\Directory1\Directory2\File1.xml", }; var

LINQ中的多个“order by”

a 夏天 提交于 2020-08-10 17:56:16
问题: I have two tables, movies and categories , and I get an ordered list by categoryID first and then by Name . 我有两个表, movies 和 categories ,我首先按 类别ID 获取有序列表,然后按 名称获取 。 The movie table has three columns ID, Name and CategoryID . 影片表有三列 ID,Name和CategoryID 。 The category table has two columns ID and Name . 类别表有两列 ID和名称 。 I tried something like the following, but it didn't work. 我尝试了类似下面的内容,但它没有用。 var movies = _db.Movies.OrderBy( m => { m.CategoryID, m.Name }) 解决方案: 参考一: https://stackoom.com/question/1Fi9/LINQ中的多个-order-by 参考二: https://oldbug.net/q/1Fi9/Multiple-order-by-in-LINQ 来源: oschina 链接:

Asp.net Core 3.1 Razor视图模版动态渲染PDF

独自空忆成欢 提交于 2020-08-10 17:43:04
Asp.net Core 3.1 Razor视图模版动态渲染PDF 前言 最近的线上项目受理回执接入了电子签章,老项目一直是html打印,但是接入的电子签章是仅仅对PDF电子签章,目前还没有Html电子签章或者其他格式文件的电子签章。首先我想到的是用一个js把前端的html转换PDF,再传回去服务器电子签章。但是这个样子就有一个bug,用户可以在浏览器删改html,这样电子签章的防删改功能就用不到,那么电子签章还有啥意义?所以PDF签章前还是不能给用户有接触的机会,不然用户就要偷偷干坏事了。于是这种背景下,本插件应运而生。我想到直接把Razor渲染成html,html再渲染成PDF。 该项目的优点在于,可以很轻松的把老旧项目的Razor转换成PDF文件,无需后台组装PDF,如果需要排版PDF,我们只需要修改CSS样式和Html代码即可做到。而且我们可以直接先写好Razor视图,做到动态半可视化设计,最后切换一下ActionResult。不必像以前需要在脑海里面设计PDF板式,并一次一次的重启启动调试去修改样式。 2.依赖项目 本插件 支持net45,net46,core的各个版本,(我目前仅仅使用net45和core 3.1.对于其他版本我还没实际应用,但是稍微调整都是支持的,那么简单来说就是支持net 45以上,现在演示的是使用Core3.1)。 依赖插件 Haukcode

ASP.NET Web API Demo OwinSelfHost 自宿主 Swagger Swashbuckle 在线文档

℡╲_俬逩灬. 提交于 2020-08-10 12:55:32
新建Web API工程 选Empty,勾选Web API,不要选择Web API,那样会把MVC勾上,这里不需要MVC Web API工程属性 XML文件用于生成在线文档 新建Windows服务作为Web API的宿主 WebApiHost工程属性 控制台应用程序方便调试 Windows服务安装Microsoft.AspNet.WebApi.OwinSelfHost 工程WebApiDemo需要引用Microsoft.Owin.dll WebApiDemo安装Swashbuckle 应用程序入口 using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.Threading.Tasks; namespace WebApiHost { static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> static void Main( string [] args) { RunDebug(); StartService(); } private static void

LINQ :最终统治了所有的语言!

孤者浪人 提交于 2020-08-10 09:52:05
LINQ:最终统治了 所有的语言! 让我们看看LINQ如何彻底改 变了.NET中访问数据的方式 .NET与其他技术栈的不同之处之一绝对是LINQ,它是Language Integrated Query的首字母缩写。实际上,它是随.NET Framework 3.5和Visual Studio 2008引入的,它是第一个独立于体系结构并集成在C#和Visual Basic语言中的框架。 借助LINQ,我们可以使用独立于各种源的单个编程模型来查询和操作数据。为了更好地理解它是什么,我们必须一步步的看下他的发展历程。 在C#的第一个版本中,我们必须使用for或foreach循环来遍历一个集合,正如我们所知,该集合实现 IEnumerable 接口,例如,在其中找到一个特定的对象。 以下代码返回公司年龄在19至36岁(20至35岁)之间的所有客户: class Customer { public int CustomerID { get; set; } public String CustomerName { get; set; } public int Age { get; set; } } class Program { static void Main(string[] args) { Customer[] customerArray = { new Customer() {