Category Archives: .NET

.NET Category

F# Journey: Course 3 – Functions

Back to: F# Journey: Course 2- Type Inference The concept of a function exists is in F# too. However, it’s slightly different than in C#. A F# function has a name, list of parameters and a return value. The function itself is assigned to a value with the “let” keyword. The parameter types are inferred… Read More »

F# Journey: Course 2 – Type Inference

Back to: F# Journey: Course 1 – Immutable Values You probably know type inference already from C#. But in F# it’s like magic! You don’t have to define the type quite often. The compiler will automatically find out. Let’s start with some examples: let a = 1 // or let plus a b = a… Read More »

My F# Journey

After working 4-5 years mainly with object-oriented programming languages like C#, I thought it’s a good time to dive into other programming paradigms. For example: Functional programming -> F#! Based on the “Indeed Trends” (see at the bottom of this post) we see that the market is still not seeking a lot F# or Scala… Read More »

F# Journey: Course 1 – Immutable Values

Back to: F# Journey By default all variables in F# are immutable. Hence.. we can not call them “variables” anymore. The term “value” fits better. Here is a simple example of an immutable value: let val1 = 2 printfn "%d" val1 Now when you try to change the value like in the code below (line… Read More »

First Time WCF Client Contracts = Nightmare!

In one of my projects (WPF, WCF) we are working with server and client side entities. Although the entities look very similar, we had some reasons to separate them: – Client side entities require more logic -> Implementation of INotifyPropertyChanged -> Implementation of IEditableObject -> Restore handling (When user cancels edit) All these functionalities were… Read More »

Generating Files With Razor Engine

The Razor engine can be used outside of ASP.NET. Beside the cool syntax, it’s a very fast engine! And it’s quite easy to use. In my example I generate a XML file based on a razor template. (You have to install the NuGet package “RazorEngine”. This is my model which I use for the rendering:… Read More »

Demistifying async/await

Microsoft introduced new keywords in C# 5.0 for asynchronous programming. Before C# 5.0 async. programming was only possible with .NET Framework classes. Now it’s implemented in the C# language itself. Here is a simple demo which shows how the keywords can be used. public async Task<string> DownloadFromWeb() { var client = new HttpClient(); return await… Read More »