49 热度

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.

收录时间: 2023-01-17
分类: C#
贡献者: Rector
43 热度

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.

收录时间: 2023-01-12
分类: C#
贡献者: Rector
75 热度

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.

收录时间: 2023-01-12
分类: ASP.NET Core
贡献者: Rector
39 热度

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#.

收录时间: 2023-01-12
分类: C#
贡献者: Rector
48 热度

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.

收录时间: 2023-01-12
分类: .NET
贡献者: Rector
54 热度

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. In this article, we will learn how to add, access, and remove elements from a ConcurrentBag in C#. Then, we will discuss the advantages and disadvantages of this collection type.

收录时间: 2023-01-05
分类: C#
贡献者: Rector
AD 友情赞助
55 热度

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 and ValueTask in C# is essential because using them correctly significantly enhances our app’s performance. In this article, we will try to understand what Task and ValueTask are and when to choose one over the other.

收录时间: 2023-01-05
分类: C#
贡献者: Rector
43 热度

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.

收录时间: 2023-01-05
分类: .NET
贡献者: Rector
44 热度

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.

收录时间: 2022-12-29
分类: C#
贡献者: Rector
71 热度

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.

收录时间: 2022-12-15
分类: .NET
贡献者: Rector
53 热度

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.

收录时间: 2022-12-14
分类: Visual Studio
贡献者: Rector
52 热度

.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.

收录时间: 2022-12-14
分类: .NET
贡献者: Rector
90 热度

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.

收录时间: 2022-12-13
分类: .NET
贡献者: Rector
120 热度

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.

收录时间: 2022-12-08
分类: ASP.NET Core
贡献者: Rector
87 热度

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.

收录时间: 2022-12-08
分类: ASP.NET Core
贡献者: Rector
AD 友情赞助
83 热度

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.

收录时间: 2022-12-08
分类: .NET 7
贡献者: Rector
89 热度

[亲测].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...

收录时间: 2022-12-04
分类: .NET 7
贡献者: Rector
97 热度

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.

收录时间: 2022-12-03
分类: C#
贡献者: Rector
90 热度

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.

收录时间: 2022-12-03
分类: .NET
贡献者: Rector
89 热度

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.

收录时间: 2022-12-03
分类: .NET
贡献者: Rector
AD 友情赞助