Category Archives: C#

C# – “ValueOf” library

By | 15/06/2022

In this post, we will see the library ValueOf that we could use for validating our classes.But first of all, what is the purpose of ValueOf?From the GitHub page:“The Smell: Primitive Obsession is using primitive data types to represent domain ideas. For example, we use a String to represent a message, an Integer to represent… Read More »

Category: C# Tags:

C# – Redis Cache

By | 06/04/2022

In this post, we will see how to manage Redis Cache in a Web API .NET Core project.But first of all, what is Redis Cache?From Redis web site:“Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes,… Read More »

Category: C# Tags:

C# – Worker Services

By | 09/02/2022

In this post, we will see how to create a Worker Service in .net core to read messages in a RabbitMQ queue.But first of all, what is a Worker Service?From Microsoft web site:“Background service processing usually doesn’t involve a user interface (UI), but UIs can be built around them. In the early days with .NET… Read More »

Category: C# Tags:

C# – RabbitMQ

By | 19/01/2022

In this post, we will see how to send notification using RabbitMQ with C#.But first of all, what is RabbitMQ?“RabbitMQ is a message-broker that offers multiple messaging protocols and features that help components asynchronously pass data (in the form of messages) among one another.”In RabbitMQ the messages are not published directly to a queue but,… Read More »

Category: C# Tags:

C# – Yield

By | 15/09/2021

In this post, we will see how to use the Yield keyword in a C# application.But first of all, what is Yield?From Microsoft web site:“When you use the yield contextual keyword in a statement, you indicate that the method, operator, or get accessor in which it appears is an iterator. Using yield to define an… Read More »

Category: C# Tags:

C# – Use IHttpClientFactory in a console app

By | 25/08/2021

In this post, we will see how to use IHttpClientFactory in a console application, in order to call a WebAPI service that gives us a list of Users like this: The url of this WebAPI is http://localhost:3000/users and I have created this service using Json Server First of all, we create a Console application project… Read More »

Category: C# Tags:

C# – 9.0

By | 16/06/2021

In this post, we will see two interesting features introduced with C# 9.0.For the complete list of all new features, we can go to Microsoft web site. RECORDSRecords provide an extremely fast way to define an immutable object with value type semantics. If we run the application, this will be the result: A Record is… Read More »

Category: C# Tags:

C# – Events

By | 10/03/2021

In this post, we will see what an Event is and how we can use it.First of all, what is an Event?From Microsoft web site:“An event is a message sent by an object to signal the occurrence of an action. The action can be caused by user interaction, such as a button click, or it… Read More »

Category: C# Tags:

C# – Dynamic Type

By | 24/02/2021

In this post, we will see what a Dynamic Type is and how to use it. Dynamic Type was introduced in C# 4.0 and it avoids compile-time type checking.It escapes type checking at compile-time and it resolves type a run time.A dynamic type variable is defined using the dynamic keyword.Let see some examples: DEFINING A… Read More »

Category: C# Tags: