代码改变世界

随笔分类 -  C#

Unhandled exception handling in iOS and Android with Xamarin.

2020-07-30 15:11 by Dorisoy, 328 阅读, 收藏, 编辑
摘要: Unhandled exceptions are hard to catch and log, and you must do it to be able to handle the errors in your app. One approach is to use Xamarin.Insight 阅读全文

Filters in ASP.NET Core

2019-12-17 09:42 by Dorisoy, 428 阅读, 收藏, 编辑
摘要: Filters in ASP.NET Core allow code to be run before or after specific stages in the request processing pipeline. Built-in filters handle tasks such as 阅读全文

.net core 从 ActionFilterAttribute 获取Request.Body 的正确方式

2019-12-17 09:37 by Dorisoy, 2914 阅读, 收藏, 编辑
摘要: 由于 ModelBinding在动作过滤器之前运行,直接使用 context.ActionArguments["parameter"] 获取模型对象 This article shows how to use an ActionFilter to validate the model from a 阅读全文

20道链表问题

2019-11-23 18:47 by Dorisoy, 181 阅读, 收藏, 编辑
摘要: 1. 如何在一次传递中找到单链表的中间元素? 答案:http://javarevisited.blogspot.sg/2012/12/how-to-find-middle-element-of-linked-list-one-pass.html 2. 如何在不使用递归的情况下反转单链表? 答案:ht 阅读全文

.Net 下基于Redlock redis 分布式锁实现

2019-11-21 11:35 by Dorisoy, 650 阅读, 收藏, 编辑
摘要: Redlock-cs (C#/.NET implementation). RedLock.net (C#/.NET implementation). Includes async and lock extension support. ScarletLock (C# .NET implementat 阅读全文

Entity Framework Core Query Types

2019-11-01 10:26 by Dorisoy, 259 阅读, 收藏, 编辑
摘要: This feature was added in EF Core 2.1 Query types are non-entity types (classes) that form part of the conceptual model and can be mapped to tables an 阅读全文

Using the Repository and Unit Of Work Pattern in .net core

2019-10-27 16:25 by Dorisoy, 771 阅读, 收藏, 编辑
摘要: A typical software application will invariably need to access some kind of data store in order to carry typical CRUD (Create, Read Update, Delete) ope 阅读全文

用于C# 的异步,持久的键值存储 Akavache 使用

2019-08-19 09:44 by Dorisoy, 703 阅读, 收藏, 编辑
摘要: Akavache是​​一个异步的,持久的(即写入磁盘)键值存储,用于在C#中编写桌面和移动应用程序,基于SQLite3。Akavache非常适合存储重要数据(即用户设置)以及过期的缓存本地数据。 开源地址:https://github.com/reactiveui/akavache/ 阅读全文

用于C#的极速序列化/反序列工具 MessagePack

2019-08-19 08:50 by Dorisoy, 1007 阅读, 收藏, 编辑
摘要: MessagePack 比MsgPack-Cli快10倍,并且优于其他C#序列化器。MessagePack for C#还内置了对LZ4压缩的支持 - 一种极快的压缩算法。对于性能追求很重要,特别是在游戏开发,分布式计算,微服务架构和缓存等应用程序中。 开源地址:https://github.com 阅读全文

Xamarin 自定义 ToolbarItem 溢出菜单实现(Popover/Popup) 弹出下拉效果

2019-03-15 10:14 by Dorisoy, 1703 阅读, 收藏, 编辑
摘要: 使用 Rg.Plugins.Popup 插件 1. 新建 PopupMenu.xaml 2. 在需要添加Toolbar 的页面中 添加 菜单项。 效果如图: 阅读全文

Xamarin.Forms FlexLayout 布局扩展+ 模板扩展+弹性换行

2019-02-25 13:16 by Dorisoy, 1236 阅读, 收藏, 编辑
摘要: Binding a FlexLayout to a Collection In May we published a doc on the new FlexLayout control that’s present in Xamarin.Forms 3.0. FlexLayout is a vers 阅读全文

Redis修改数据多线程并发—Redis并发锁

2018-01-23 10:38 by Dorisoy, 890 阅读, 收藏, 编辑
摘要: .Net Redis 基本用法 http://www.zhifeiya.cn/post/net-redis http://www.cnblogs.com/tdws/p/5712835.html 阅读全文

C# Tuple<T1,T2....T>元组的使用

2018-01-23 09:05 by Dorisoy, 1394 阅读, 收藏, 编辑
摘要: 1) 先说组元:一个数据结构,由通过逗号分割的,用于传递给一个程序或者操作系统的一系列值的组合。 NET Framework 直接支持一至七元素的元组 Tuple<T1> Tuple<T1, T2> Tuple<T1, T2, T3> Tuple<T1, T2, T3, T4> Tuple<T1, 阅读全文

C# 准确获取系统 CPU 使用率

2017-12-13 08:33 by Dorisoy, 10858 阅读, 收藏, 编辑
摘要: 1. PerformanceCounter 注意:(32位下不是线程安全的) 2.WMI 阅读全文

ASP.NET CORE 2.0 Uses SignalR Technology

2017-12-11 10:41 by Dorisoy, 188 阅读, 收藏, 编辑
摘要: https://www.codeproject.com/Articles/1208322/ASP-NET-CORE-Uses-SignalR-Technology 阅读全文

构建 Owin 中间件 来获取客户端IP地址

2017-11-21 13:47 by Dorisoy, 1080 阅读, 收藏, 编辑
摘要: Not so long ago, we discussed on this blog the possible ways of retrieving the client’s IP address in ASP.NET Web API. With the latest changes in the 阅读全文

多线程通用处理队列类(三)

2017-11-02 12:20 by Dorisoy, 707 阅读, 收藏, 编辑
摘要: 使用: 阅读全文

多线程通用处理队列类(二)

2017-11-02 12:06 by Dorisoy, 432 阅读, 收藏, 编辑
摘要: 1 public class DownLoadFile 2 { 3 public string FileName { get; set; } 4 5 } 6 /// 7 /// 下载线程队列 8 /// 9 public class DownLoadQueueThread : Que... 阅读全文

多线程通用处理队列类(一)

2017-11-02 11:43 by Dorisoy, 1617 阅读, 收藏, 编辑
摘要: 最近实现了一个支持多FTP,同时FTP要多线程上传的小项目,通过对线程池的动态管理,很好的解决了同一时刻允许最大线程和空闲线程时任务自动入队的的问题,贴出来给大家使用: 使用示例: 阅读全文

SignalR WebSocket Error during WebSocket handshake: net::ERR_CONNECTION_RESET

2017-09-12 09:27 by Dorisoy, 7017 阅读, 收藏, 编辑
摘要: system.web 节点添加: <httpRuntime maxRequestLength="104857600" executionTimeout="1200" targetFramework="4.5" requestValidationMode="2.0" /> 阅读全文