14 热度

C# 8 的模式匹配

C# 8 的模式匹配,更多内容请查看官方文档:https://docs.microsoft.com/zh-cn/dotnet/csharp/whats-new/csharp-8#more-patterns-in-more-places?WT.mc_id=DT-MVP-5003302

收录时间: 2019-10-15
分类: C#开发
贡献者: Rector
4 热度

Anonymous classes and generics limit in .NET/C#?

Have you ever looked how anonymous classes are implemented? If you did, you know it’s a generated generic class. And if you didn’t, you know now. Either way, you can find more details below. But also building on top of [previous post about generic parameters limit in generic classes], where’s the limit here? It surely cannot be higher.

收录时间: 2019-10-15
分类: C#开发
贡献者: Rector
19 热度

C#调用OpenCV开发简易版美图工具

在C#调用OpenCV其实非常简单,因为C#中有很多OPenCV的开源类库。本文主要介绍在WPF项目中使用OpenCVSharp3-AnyCPU开源类库处理图片,下面我们先来做开发前的准备工作。准备工作首先,我们先创建一个WPF项目。然后,在Nuget上搜索OpenCVSharp,如下图:接着,我们选择OpenCVSharp3-AnyCPU选项进行安装 。安装了OpenCVSharp3-AnyCPU后,我们的项目会自动引入4个类库,如下图:  到这里,我们的准备工作就完成了,非常简单。C#中应用OPenCV现在,我们进入项目,进行OPenCV的调用。我们先引入OpenCV相关的命名空间,如...

收录时间: 2019-10-09
分类: C#开发
贡献者: Rector
30 热度

Non-nullable references with C# 8 and .NET Core 3.0

Two weeks ago .NET Core 3.0 was officially published. Together with the new framework version, Visual Studio 2019 got support for a long-awaited C# 8.0. The complete list of the new language features is available here on the MSDN, but the one that deserves special attention is Nullable reference types...

收录时间: 2019-10-08
分类: C#开发
贡献者: Rector
22 热度

How to Stress the C# Compiler

C# is (mostly) a strongly typed programming language. It's type system supports generics, inference, and method overloading. Combining these features, any C# compiler can easily be knocked out. This blog article demonstrates a few approaches. One of them knocks out the programmer more than the compiler, but that's not so important.

收录时间: 2019-10-08
分类: C#开发
贡献者: Rector
18 热度

What’s the maximum number of generic parameters for a class in .NET/C#?

Pretty stupid question, right? Because if it’s more than, say, 20 or 100, it’s enough. But still. Where is the limit? We can look at this in, at least, two ways. First is obviously what the runtime is willing to load and the other is what Roslyn is able to compile. And there’s a good chance, that these two limits are the same.

收录时间: 2019-10-05
分类: C#开发
贡献者: Rector
AD 友情赞助
33 热度

用 C# 来守护 Python 进程

目前我主要负责的一个项目是一个 C/S 架构的客户端开发,前端主要是通过 WPF 相关技术来实现,后端是通过 Python 来实现,前后端的数据通信则是通过 MQ 的方式来进行处理。由于 Python 进程是需要依赖客户端进程来运行,为了保证后端业务进程的稳定性,就需要通过一个 守护进程 来守护 Python 进程,防止其由于未知原因而出现进程退出的情况...

收录时间: 2019-09-30
分类: C#开发
贡献者: Rector
26 热度

C# 8 Interfaces: Unit Testing Default Implemetation

This article uses 2 projects. UnitTests.Library is a .NET Standard 2.1 class library that contains the interface. UnitTests.Tests is a .NET Core 3.0 NUnit unit test project; this contains the tests.

收录时间: 2019-09-30
分类: C#开发
贡献者: Rector
36 热度

gRPC and C# 8 Async stream cancellation

In the previous post “gRPC and C# 8 Async stream“, we looked at how gRPC server stream and C# 8 Async stream work great together. In this post, we are looking at the way we can, from the client, stop the server to stream results back.

收录时间: 2019-09-27
分类: C#开发
贡献者: Rector
35 热度

All you wanted to know about IDisposable

So, what is IDisposable and what is disposing of objects? This is something I teach to developers classes before they are going to their first school practice at some company. One of important concepts is disposing. Here’s my story about it.

收录时间: 2019-09-26
分类: C#开发
贡献者: Rector
23 热度

A Closer Look at C# 8 Interfaces

There are a lot of changes to interfaces in C# 8 -- not just default implementation. Last time, I had a bit of a rant about those changes. Now it's time to settle down and take a closer look at what those changes are and better understand them.

收录时间: 2019-09-24
分类: C#开发
贡献者: Rector
46 热度

gRPC and C# 8 Async stream

gRPC and its idea to describe an API in a standardized file, which can generate both client and server code to interact in different languages is a compelling idea. In this post, I would like to have a quick look at the experience you would have with gRPC streaming capability and the new C# 8 async streams, which sounds like a perfect match.

收录时间: 2019-09-20
分类: C#开发
贡献者: Rector
73 热度

C# 表达式树Lambda扩展(四)

本来计算这篇文章在后面需要运用的时候写的,但是既然写到表达式的扩展呢,就一起写完吧。看到这个标题就有一种疑问,Lambda表达式本来就是表达式树,还需要怎么扩展?那就看看下面的内容,你就知道了...

收录时间: 2019-09-16
分类: C#开发
贡献者: Rector
58 热度

C#委托(delegate、Action、Func、predicate)和事件

刚开始工作的时候,觉得委托和事件有些神秘,而当你理解他们之后,也觉得好像没有想象中的那么难。在项目中运用委托和事件,你会发现他非常棒,这篇博文算是自己对委托和事件的一次梳理和总结。

收录时间: 2019-09-15
分类: C#开发
贡献者: Rector
484 热度

Writing high performance code despite C#

Writing high performance code despite C#.

收录时间: 2019-09-14
分类: C#开发
贡献者: Rector
AD 友情赞助
98 热度

C#高级语法之泛型、泛型约束,类型安全、逆变和协变(思想原理)

一、为什么使用泛型?泛型其实就是一个不确定的类型,可以用在类和方法上,泛型在声明期间没有明确的定义类型,编译完成之后会生成一个占位符,只有在调用者调用时,传入指定的类型,才会用确切的类型将占位符替换掉。首先我们要明白,泛型是泛型,集合是集合,泛型集合就是带泛型的集合。

收录时间: 2019-08-25
分类: C#开发
贡献者: Rector
98 热度

A Complete C# Arrays Tutorial

C# array is a collection of data types such as int, strings, or doubles. This complete tutorial on arrays starts with defining arrays and array types in C# and how to use Arrays in a .NET application using C#.

收录时间: 2019-08-23
分类: C#开发
贡献者: Rector
81 热度

委托和lambda表达式,Action和Func

我们为什么要有委托?任何东西存在即合理,不合理的也会被时间淘汰掉,委托既然存在肯定有存在的必要,我们来看一下什么时候可以用到委托。

收录时间: 2019-08-21
分类: C#开发
贡献者: Rector
70 热度

Create a Blockchain Explorer in C#

Blockchain technology is already central to major cryptocurrencies like Bitcoin and its applications are ever growing. A blockchain is simply a list of records, called blocks. Each block contains information about transactions - and also confirms the validity of the previous block with something cal...

收录时间: 2019-08-15
分类: C#开发
贡献者: Rector
94 热度

Logging in C# .NET Modern-day Practices: The Complete Guide

Logging is a big part of software development for many years now. One can argue that a logging mechanism is a must-have part of any application or library. I would agree with that statement.Logging has a crucial part to play in a scenario where you can’t use interactive debugging (that is, attaching...

收录时间: 2019-08-14
分类: C#开发
贡献者: Rector
AD 友情赞助