Encrypting and Decrypting a String in C#
In this article, we will learn how encrypting and decrypting a string is done using C# and the Cryptography package that comes included with .NET.
Generic Attributes in C#
In this article, we are going to learn how generic attributes help us implement better custom attributes through a practical example.
Mocking dependencies in ASP.NET Core tests
As I recently spent some time writing and refactoring tests that utilize WebApplicationFactory, I’ve come to have some thoughts and ideas for improvement that I’d like to share. In this article, I’ll delve into the process of mocking dependencies in a DI container when using WebApplicationFactory, and offer some insights and best practices I’ve learned along the way. Whether you’re a seasoned pro or new to unit testing ASP.NET Core applications, I hope this information will be helpful as you work to simplify and streamline your tests.
How to Iterate Over JSON Objects in C#
Manipulating JSON objects is a common operation in applications. In this article, we will look at different ways of iterating over JSON objects in C#.
Rebus in .NET - Service Bus Implementation
When working with distributed applications that need to asynchronously communicate with each other, the “Publish-Subscribe” pattern is very common. To avoid being tightly coupled to a message broker, such as RabbitMQ, we use an abstraction layer, known as a service bus. Rebus is one such service bus implementation for .NET that allows us to easily communicate asynchronously between services. This article makes use of Docker to run our message broker (RabbitMQ) server locally.
ConcurrentBag in C#
In C#, there are many classes that we can use to represent a group of objects that we may manipulate concurrently using multiple threads. One such class is the ConcurrentBag
Understanding Task and ValueTask in C#
If we want to optimize our code and improve the performance of our app, there is no one go-to solution. Instead, we analyze our code and try to find where to improve. Understanding Task
How to Add a BearerToken to an HttpClient Request
Often, in our daily routine, we have to deal with secure APIs and use a BearerToken to make HTTP requests. In this article, we are going to learn the correct way to add a BearerToken to an HttpClient request.
IEnumerable in C#
In this article, we are going to learn about IEnumerable in C#. IEnumerable acts as an abstraction over a collection and allows us to iterate over it without knowing the actual type of the collection.
Working With Collections in .NET
When we develop software applications, we may need to create, store and manipulate groups of related objects. In this article, we will discuss the various ways in which we can perform such operations using different collections in .NET.
Try out Visual Studio 2022 version 17.5 Preview 2
I’m excited to share today we released Visual Studio 2022 17.5 Preview 2! Your feedback goes directly to the product team working to deliver you the best developer IDE. We welcome your feedback on Developer Community where we are always eager to hear your suggestions for new or existing features and learn about any bugs or issues via report a problem.
.NET December 2022 Updates – .NET 7.0.1, .NET 6.0.12, .NET Core 3.1.32
Today, we are releasing the .NET December 2022 Updates. These updates contain security and non-security improvements. Your app may be vulnerable if you have not deployed a recent .NET update. You can download 7.0.1, 6.0.12, and 3.1.32 versions for Windows, macOS, and Linux, for x86, x64, Arm32, and Arm64.
Schedule Jobs with Quartz.NET
Recurring, background tasks are widespread and very common when building applications. These tasks can be long-running or repetitive and we don’t want to run them in the foreground, as they could affect the user’s experience of the application. So instead we must schedule these jobs to run in the background somewhere. To achieve this in .NET, we can use the Quartz.NET library to manage the creation and scheduling of these jobs. This article makes use of Docker to run SQL Server server locally. Optionally a local install of SQL Server can be used.
How to Extract Custom Header in ASP.NET Core Web API
In this article, we are going to learn about the different ways we can extract Custom Headers from our ASP.NET Core Web API requests.
Implement Feature Management in Blazor ASP.NET Core
The post shows how features toggles or feature switches can be implemented in an ASP.NET Core application using Blazor. The Microsoft.FeatureManagement Nuget package is used to add the feature toggles.
5 new MVC features in .NET 7
Many of the headline features introduced in ASP.NET Core in .NET 7 were about minimal APIs, such as route groups and filters. But just because minimal APIs were a big focus doesn't mean that MVC controllers were left out in the cold! In this post I discuss some new MVC features that were introduced in .NET 7.
[亲测].NET Core(.NET 7)Web应用部署到Ubuntu的Docker容器并配置Nginx反向代理及Let's Encrpt SSL证书自动续期
本文将为C#&.NET开发者介绍《.NET Core(.NET 7)Web应用部署到Ubuntu的Docker容器并配置Nginx反向代理及Let’s Encrpt SSL证书自动续期》。先看最终部署和运行的效果图:本文你将学习到:如何在Ubuntu中创建用户;如何在Ubuntu中将用户添加到sudo组;如何在Ubuntu中安装Nginx;如何在Ubuntu中使用Certbot插件获取SSL证书;如何使用Visual Studio 2022创建.NET 7 Web网站应用程序;如何将.NET Core(.NET 7)Web应用程序制作成本地Docker镜像;如何在Ubuntu服务器的Doc...
Introducing C# 11: Required properties
C# 11 improves the initialization of objects and struct. Marking one or more properties as mandatory on initialization is now possible and will help you not to forget to initialize your properties correctly. In this post I will show you how it works with the object initializer syntax and the object instantiation with a constructor.
Producer-Consumer Applications With .NET Channels
When building applications, usually we need to create long-running background tasks, that can be sent to one or more background processes. This is known as a producer/consumer pattern. For these scenarios, we need something more robust than a first-in, first-out queue, but we don’t need the complexity and infrastructure involved in a message broker such as RabbitMQ, which is where Channels comes in.
What’s new in the .NET MAUI Community Toolkit
November has been a busy time for the .NET MAUI Community toolkit with multiple releases featuring a ton of amazing new features (not to mention a long list of bug fixes). The latest releases have new Views, Layouts, Tizen support, .NET 7 support and so much more. This post will get you up to speed on all the new features.