2020年9月8日
摘要: 方法1:使用Sort 思路:随机生成-1或者0,使得排序到目标元素有50%几率和下一个元素发生交换 public static void Sort1(List<string> arr) { arr.Sort((x, y) => { return new Random().Next(-1, 1); } 阅读全文
posted @ 2020-09-08 10:57 杂酱面 阅读(2330) 评论(0) 推荐(1) 编辑
摘要: public static string[] GetFileNames(string dir) { var names = new List<string>(); var files = Directory.GetFiles(dir); names.AddRange(files); var dirs 阅读全文
posted @ 2020-09-08 10:02 杂酱面 阅读(240) 评论(0) 推荐(0) 编辑
  2020年4月22日
摘要: .netcore程序发布到linux然后执行dotnet xxx.dll,如果退出shell终端,程序也会跟着退出,则需要使用supervisor来守护 环境centos7,.netcore3.1 1,安装supervisor yum install supervisor 2,设置开启启动 syst 阅读全文
posted @ 2020-04-22 19:41 杂酱面 阅读(307) 评论(0) 推荐(0) 编辑
摘要: Swagger是最受欢迎的REST APIs文档生成工具之一,话不多说立即开始 1,在NuGet中搜索swagger,由于我使用的是.netcore3.1,所以选择Swashbuckle.AspNetCore安装即可 2,在Startup.cs文件中的ConfigureServices方法和Conf 阅读全文
posted @ 2020-04-22 10:27 杂酱面 阅读(442) 评论(0) 推荐(0) 编辑
摘要: winform或者wpf项目中难免会遇到忘记捕获的异常的代码块,c#为我们提供了全局捕获异常的机制 winform中在Program.cs中这样写 static class Program { [STAThread] static void Main() { Application.SetUnhan 阅读全文
posted @ 2020-04-22 09:14 杂酱面 阅读(908) 评论(0) 推荐(0) 编辑