How to use decimal with mongodb and .NET C#

MongoDB doesn’t support decimal. How can we use it to represent money? This article will explain it to you.


When working with money we need to be concerned with the accuracy of the data as well as the calculations we do. Imagine that you have an ecommerce website with a feature that allows users to have a credit balance on their accounts. One user has 86.25€ and had just spend 86.24€. We expect him to be left with 0.01. But is he?


Continue reading How to use decimal with mongodb and .NET C#


Using Roslyn to validate guard clauses - CodeFixProvider

An example using Roslyn to stop doing if return else statements. It’s bad for maintainability and it is error prone.


In my last post, I showed you how to build an Analyzer to detect inadequate guard clauses. But we can do more with Roslyn API and I’ll show you today how we can give a suggestion to our developers on how can they fix it propertly.


Continue reading Using Roslyn to validate guard clauses - CodeFixProvider


Using Roslyn to validate guard clauses

An example using Roslyn to stop doing if return else statements. It’s bad for maintainability and it is error prone.


In one of my previous posts, I talked about Not every if–then-else statement, needs the else.. Today, we’ll explore the creation of an Analyzer using Roslyn API, that will analyze the source code looking for any Guard clause with If-Return-Else or If-Throw-Else.


Continue reading Using Roslyn to validate guard clauses



Pagination


© 2017. All rights reserved.

Powered by Hydejack v6.3.0