Category Archives: 7672

WAQS: Math.Round

7 reasons to use WAQS WAQS documentation   I recently had a surprise with .NET: Math.Round(3.5) = 4 (expected) but Math.Round(2.5) = 2.   Indeed, by default, Math.Round uses MidpointRounding.ToEven option.   However, SQL Round uses the AwayFromZero mode. So … Continue reading

Posted in 16868, 18204, 7671, 7672 | Leave a comment

Interface implementation delegation

My friend Simon proposed a very interesting new feature for C# IMO yesterday for delegating interface implementation to a class field. You can download his documentation here.   And so, of course, people who know me know that I love … Continue reading

Posted in 16402, 7672 | 2 Comments

How to use caching with IQueryable?

Sometimes when you use an IQueryable, you want to use a caching strategy in order to not querying your data source each time. In this post, I propose a basic implementation as a proof of concept. When you use an … Continue reading

Posted in 12253, 7671, 7672, 7674 | Leave a comment

Roslyn fluent APIs: RoslynHelper NuGet package

If you use Roslyn and you want to simplify the code rewriter, I recommend you to install my NuGet package RoslynHelper.

Posted in 16402, 7671, 7672 | Leave a comment

Use Roslyn to improve C#/VB compiler

I published a POC using Roslyn to improve C# compiler. Enjoy!

Posted in 16402, 7671, 7672 | Leave a comment

LINQ Expressions are more permissive than C#

When we use Collection initializers, we can’t write many instructions in the initialization: public class C { public int MyProperty { get; set; } } var test = new List<C>() { new C { MyProperty = { int i = 1; i … Continue reading

Posted in 7671, 7672 | 5 Comments

TechDays Paris Roslyn compiler demo

Two days ago, I spoke at Microsoft TechDays in Paris, France on Roslyn. I made several demos including one where I build my own C# compiler that allows me to add features on C#.   This compiler supports AOP in … Continue reading

Posted in 16402, 7671, 7672 | 4 Comments

Coding for fun: Write your code in comments with Roslyn

Sometimes, you have some very basic methods and you could find useless to comment them but sometimes you have to comment them in order to generate help file. Some tools allow you to generate comments using the method signature. For … Continue reading

Posted in 16402, 7671, 7672 | 6 Comments

Roslyn: InvokeActivity using T4

Imagine the following scenario: in a project, there are developers and some functional experts. Functional experts have to design some workflows. Developers have to code some methods usable by workflows. The issue in this scenario is InvokeActivity. To use it, … Continue reading

Posted in 10511, 16181, 16402, 7672 | 2 Comments

EnumerableCollection

Imagine the following scenario. You use MVVM, you have two classes on your model: public class Child{} public class Parent{    private ObservableCollection<Child> _children;    public ObservableCollection<Child> Children    {        get { return _children ?? (_children = new ObservableCollection<Child>()); }    }} You have two more classes on your ViewModel: public class ChildViewModel{    … Continue reading

Posted in 13461, 7671, 7672, 8708 | Leave a comment