1685 热度

How to Get Formatted JSON in .Net Using C#

This article will examine how we can get a formatted JSON representation of our C# objects using two popular libraries – Json.NET and System.Text.Json.

收录时间: 2023-02-16
分类: C#
贡献者: Rector
1697 热度

PostgreSQL in C# .NET with Npgsql, Dapper, and Entity Framework: The Complete Guide

We’ll talk today about combining Postgres with my favorite language and runtime: C# and .NET. Just because Postgres isn’t a first-party Microsoft database, like SQL Server, doesn’t mean you don’t have full support for it in C#. You absolutely do, and in this article, you’ll see modern ways to do just that. You’ll see how to interact between Postgres and C# using the standard data provider library Npgsql, use it with Dapper, and even with Entity Framework. We’ll go over the basic operations like creating a table, inserting rows, deleting, and updating records using all of these frameworks.

收录时间: 2023-02-08
分类: C#
贡献者: Rector
1371 热度

ConcurrentDictionary in C# - Detailed Guide

We’ve already written about a regular Dictionary in C#. We’ve also explored the basics of ConcurrentDictionary as one of many Concurrent Collections in C#. In this article, we will go into more detail and explore the use cases in which ConcurrentDictionary can be useful to us.

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

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
1088 热度

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
1899 热度

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
AD 友情赞助
1718 热度

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
1618 热度

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
1302 热度

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
1095 热度

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
935 热度

Introducing C#11: Raw string literals

C# 11 brings new syntax for writing plain text. Instead of relying on string interpolation with the character $ and the verbatim with @ character for writting on several lines, C# 11 allows using three double quotes. There is no need to double the quotes in the text to escape a double quote anymore. In this post, I will show you a simple example of it!

收录时间: 2022-11-30
分类: C#
贡献者: Rector
1332 热度

Floating-Point Types in C# - Double vs Float vs Decimal

In this article, we are going to cover floating-point types in C#. Our focus will be mainly on Double, Float and Decimal data types. We have covered the basic data types extensively, and you can check out this article if you feel the need to brush up on the basics.

收录时间: 2022-11-30
分类: C#
贡献者: Rector
942 热度

C# String Interpolation

Very early in the history of programming, we’ve seen the need to use text on a machine that works with numbers. Over many decades we devised many different ways to construct and analyze text for better understanding by both humans and machines. String interpolation, in the way that C# offers it, is the most elegant and readable way to construct text messages we’ve seen so far.

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

How to Check if a String Ends With a Number in C#

Checking if a string ends with a number in C# is a very common operation. In this article, we are going to show various ways in which we can do this. 

收录时间: 2022-11-27
分类: C#
贡献者: Rector
1206 热度

SortedSet in C#

A SortedSet in C# is a data structure that allows us to store and access elements in sorted order. In this article, we are going to explore how to create and use the SortedSet class in C#. We are also going to look at some of the benefits and drawbacks of using this data structure. Finally, the article concludes with tips on taking advantage of the C# SortedSet in our applications.

收录时间: 2022-11-10
分类: C#
贡献者: Rector
AD 友情赞助
915 热度

Welcome to C# 11

I am excited to announce that C# 11 is out! As always, C# opens some entirely new fronts, even while advancing several themes that have been in motion over past releases. There are many features and many details, which are beautifully covered under What’s new in C# 11 on our docs pages. What follows here is an appetizer of some of the highlights – small and big.

收录时间: 2022-11-09
分类: C#
贡献者: Rector
1452 热度

How to Use HTML Agility Pack in C#

In this article, we’re going to learn how to use HTML Agility Pack in C# and review some examples of its most important features.

收录时间: 2022-11-09
分类: C#
贡献者: Rector
1534 热度

Tasks vs Threads in C#

In this article, we are going to look at the main differences between Tasks and Threads. They are both used for concurrent programming, but Tasks were later introduced with .NET Framework 4.

收录时间: 2022-11-09
分类: C#
贡献者: Rector
1372 热度

Concurrent Collections in C#

Concurrent Collections in C# are a set of collections designed for synchronized multi-thread access. We can find concurrent collections under the System.Collections.Concurrent namespace. Nowadays, where it is getting increasingly important and accessible to work in a multi-threaded environment, concurrent collections are essential. .NET provides a set of concurrent collections. In this article, we will try to understand what concurrent collections are, the collections that have thread-safe variants, and the constraints of concurrent collections.

收录时间: 2022-11-04
分类: C#
贡献者: Rector
1194 热度

HashSet in C#

In this article, we are going to take a look at the HashSet class in C#. We will discuss how to use it and its key features. Also, we are going to see some examples of how to use it in practice. Finally, we’ll compare it to other data structures available in C#.

收录时间: 2022-11-04
分类: C#
贡献者: Rector
AD 友情赞助