随笔分类 -  C#

C#的一些东东
摘要:knife4j for .net core 对应github 安装对应包 using Microsoft.AspNetCore.Mvc.Controllers using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGe 阅读全文
posted @ 2020-12-28 17:47 Cein 阅读(1094) 评论(0) 推荐(0)
摘要:对应添加就完事 发布 set workDir=%cd% cd %workDir%/Src/ZT.AAA.API dotnet publish --runtime linux-x64 --framework netcoreapp2.2 --self-contained -c Release -o %w 阅读全文
posted @ 2020-12-28 17:30 Cein 阅读(579) 评论(0) 推荐(0)
摘要:.net core中默认不支持gb2312编码 需要引入 System.Text.Encoding.CodePages 然后,Startup注册 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); 阅读全文
posted @ 2020-03-05 14:54 Cein 阅读(1027) 评论(0) 推荐(0)
摘要:引用 ZXing 然后如下代码 使用 阅读全文
posted @ 2019-12-10 18:18 Cein 阅读(839) 评论(0) 推荐(0)
摘要:.net core环境下怎么引入就不说了 引入IHttpContextAccessor是为了在服务中读取HttpContext,因为带了个token,所以手动的从head里取出来加上 扩充一下post 阅读全文
posted @ 2019-10-23 15:53 Cein 阅读(361) 评论(0) 推荐(0)
摘要:List<T>以string类型为例,实际应用中可换做其他类型: 1:取交集 结果: BB GG 2:取差集 结果: AA CC EE 结果如下: DD MM listA.Except(B).ToList(); 注:差集表示listA中哪些值是listB中所不存在的; 3:取并集 结果: AA BB 阅读全文
posted @ 2019-09-05 14:21 Cein 阅读(11354) 评论(0) 推荐(4)
摘要:1. 2.引入HttpClient 注入 使用 httpClint使用看大佬的:wzk153 阅读全文
posted @ 2019-07-11 14:20 Cein 阅读(1933) 评论(0) 推荐(1)
摘要:using System; using System.Collections; namespace YieldDemo { class Program { public static IEnumerable Power(int num, int exponent) { int counter = 0; ... 阅读全文
posted @ 2018-09-29 17:57 Cein 阅读(286) 评论(0) 推荐(0)
摘要:调用 阅读全文
posted @ 2018-06-07 17:24 Cein 阅读(227) 评论(0) 推荐(0)
摘要:.net 的就不用说了,看这位老哥的 http://www.cnblogs.com/alunchen/p/6888002.html 现在来讲.net core Nuget Packages安装,使用程序包管理器控制台,安装命令:Install-Package Swashbuckle.AspNetCo 阅读全文
posted @ 2018-05-29 11:54 Cein 阅读(516) 评论(0) 推荐(0)
摘要:环境是windows Server2012 问题的原因是缺少文件:api-ms-win-crt-runtimel1-1-0.dll, dotnet 启动程序失败。 可以先看官方的找个链接 https://docs.microsoft.com/en-us/aspnet/core/publishing/ 阅读全文
posted @ 2018-05-19 17:26 Cein 阅读(1620) 评论(0) 推荐(0)
摘要:1.读取文本 2.写入文本 原文:https://blog.csdn.net/sinat_32832727/article/details/53768116 阅读全文
posted @ 2018-05-17 15:33 Cein 阅读(503) 评论(0) 推荐(0)
摘要:官方文档:href 在老版本的ASP.NET里,项目的全局配置一般都存在web.config里的appSettings里,只需要用ConfigurationManager.AppSettings[“Foo”]就可以把名为Foo的变量取出来。在ASP.NET Core里,访问配置文件的方式也有了很大变 阅读全文
posted @ 2018-05-09 11:52 Cein 阅读(940) 评论(0) 推荐(0)
摘要:注入: 新建对应类 登录注销 需要验证的控制器中加入 例: 阅读全文
posted @ 2018-05-08 16:55 Cein 阅读(648) 评论(0) 推荐(0)
摘要:原文:stackoverflow 阅读全文
posted @ 2018-05-08 14:24 Cein 阅读(547) 评论(0) 推荐(0)
摘要:写了一个.net core上传的公用类调用 using System; using System.Collections.Generic; using System.Configuration; using System.IO; using System.Linq; using System.Tex 阅读全文
posted @ 2018-05-05 14:15 Cein 阅读(382) 评论(0) 推荐(0)
摘要:1.(int) 适合简单数据类型之间的转换,C#的默认整型是int32(不支持bool型)。 2. int.Parse(string sParameter) 是个构造函数,参数类型只支持string类型,Parse就是把String类型转换成int,char,double....等,也就是*.Par 阅读全文
posted @ 2018-02-03 15:50 Cein 阅读(481) 评论(0) 推荐(0)
摘要:记录一下 DES加密 解密: 阅读全文
posted @ 2018-02-02 18:25 Cein 阅读(383) 评论(0) 推荐(0)
摘要:今天写个接口,要求如下,需要对应的AES加密(128位),例子php的 C#实现 输出为Base64将我注释的取消就行,这个是因为需求要的是hex格式 阅读全文
posted @ 2018-02-02 18:20 Cein 阅读(533) 评论(0) 推荐(0)
摘要:public static string MD5(string encypStr) { return MD5(encypStr, "utf-8"); } /** 获取大写的MD5签名结果 */ public static string MD5(string encypStr, string charset) ... 阅读全文
posted @ 2018-02-02 18:15 Cein 阅读(245) 评论(0) 推荐(0)