Advanced LINQ
LINQ is an extremely useful library with many applications. These applications are not all utilized or understood equally. In this article, we are going to take a look at some advanced LINQ capabilities to perform grouping, joining, partitioning, and even converting object types.
Dictionary vs Hashtable in C#
In this article, we are going to compare Dictionary and Hashtable in C#. We will start with a brief introduction to both data structures and then proceed to the comparison.
Common C# Programming Mistakes
In this article, we are going to look at some common C# programming mistakes. We are pretty sure that there are a lot more mistakes that developers make while writing their projects, but here, we will try to summarize the ones we often noticed while working with other developers.
What is NullReferenceException in C#?
In C#, a NullReferenceException occurs when we try to access a variable whose value has not been set or has been set to null. It can be easy to trigger this exception accidentally, so it’s important to be aware of how to avoid it in the first place. In this article, we’ll take a look at some common causes of NullReferenceException errors and how to fix them. We’ll also discuss ways to prevent NullReferenceException errors from happening in the first place.
FileSystemWatcher in C#
.NET provides a handy way to deal with monitoring different file system changes. In this article, we will discuss what FileSystemWatcher is, how to set it up, and how to configure it to observe various file system changes. In addition, we will take a look at the caveats of FileSystemWatcher.
Indexers in C#
In this article, we are going to learn about Indexers in C#, how to declare them in a class, struct, or interface, and overload them. We’re also going to learn what the differences between indexers and properties are.
Type Checking and Type Casting in C#
In this article, we are going to learn various ways of converting a value from one type to another (type casting) and how to check the type of a value at run time (type checking).
C# 11新特性之原始字符串
朋友们大家好,我是Rector,码友网的创建者和维护者,专注C#&.NET技术开发。本文为大家分享的主题是《C# 11新特性之原始字符串》,本文相应的视频: C# 11新特性-原始字符串美国时间2022年4月18日,微软发布了Visual Studio 17.2 预览版 3和.NET 7预览版 3,其中包含了一些C# 11的新特性,本视频就为大家演示一下C# 11中的原始字符串这个新特性。微软官方的表述是:” Raw string literals”,这里翻译成”原始字符串”。从字面不难看出,它是适用于字符串的新特性,解决字符串中特殊字符的新语法。原始字符串字面量可以包含任意文本,包括空格、新...
System.Text.Json - Polymorphic Serialization and Deserialization
In this article, we are going to deal with a special case of JSON processing, polymorphic serialization, and deserialization with System.Text.Json. The introduction of the System.Text.Json package has given .NET developers another powerful option for JSON format handling. You can get a full description of the package here.
C# 给Word每一页设置不同文字水印
Word中设置水印时,可预设的文字或自定义文字设置为水印效果,但通常添加水印效果时,会对所有页面都设置成统一效果,如果需要对每一页或者某个页面设置不同的水印效果,则可以参考本文中的方法。下面,将以C# 代码为例,对Word每一页设置不同的文字水印效果作详细介绍。
Base64 Encode and Decode in C#
In this article, we will learn about how to Base64 encode and decode in C#.
How to Turn a C# Object Into a JSON String in .NET?
In this article, we’re going to learn how to serialize a C# object into a JSON string using the two main JSON libraries in the .NET ecosystem. Also, we’re going to learn how to control different aspects of the serialization process.
Constructors in C#
In this article, we will discuss Constructors in C# and different types of constructors. More importantly, we will discuss these constructors’ differences and use cases.
Ranges and Indices in C#
In this article, we are going to learn more about ranges and indices in C#, and how to use them to access a single or a range of elements in a sequence. We’ll also see how ranges and indices help us write cleaner and more readable code.
Async Enumerable in C# (Part 3)
In this third part of my series on IAsyncEnumerable
Using Refit to Consume APIs in C#
Consuming APIs over HTTP is a very common scenario when building applications. In this article, we are going to explore Refit to consume APIs in C#.
How to Use Span in C# to Improve Application Performance
Performance is always an important factor in software development. It is not something only the developers of a framework must consider. When the .NET team released the Span<> class they empowered developers to improve application performance, if used correctly. In this article, we will learn about Span in C#, how it is implemented, and how we can use it to increase performance.
C# Winform 相册功能,图片缩放,拖拽,预览图分页
在很多项目中也需要用到预览图片的功能,至于为什么加一个添加图片的功能,是因为有些项目,比如视觉相关的工作,会需要摄像机采集图片,然后显示在界面上,所以,图片也是一张一张的添加的,另外,就是分页功能,当预览图位置不够用时就会用到,所以我也加了进来。
C# Winform 自定义进度条ProgressBar
Winfrom各种老毛病真的不适合做大型项目,甚至中型项目都不适合,一些小功能都能把你折腾半死,比如,我想在界面上显示一个进度条,用来显示现在硬盘和内存已经使用了多少,使用了 ProgressBar 控件你看看效果:进度条中间一直有个白色光影在晃来晃去的,是不是想让别人感慨:“哇!好强的光芒,我的眼睛快睁不开了...”。而且背景颜色无法改变,这个动画也无法关掉,为了解决这两个问题,我找了很久,终于找到了下面的解决方法。二、自定义进度条于是我在网上找了一些资料,有到效果有,但不是特别漂亮,比如下面这个C# WinForm 自定义进度条控件_科技_品阅网另外,我参考了下面到帖子Win...
Async Enumerable in C# (Part 2)
In this second part of my series on IAsyncEnumerable