C Sharp tags

Nullable and notnull Serialisation Properties

The C# 8 feature Nullable has been well received by myself and others into our workflows and has improved code bases immensely. However, there is one niggly workaround that I’m not a fan of, and that is = default!; problem definition // This class is used to serialise/deserialise a payload from a server public …

Looking Back on C# 7: Pattern matching

With C# 8 on our doorstep, I figure it is a good time to reflect on recent additions to the language that have come before. There are some great improvements you may have missed, some that I really enjoy using, and some I consider have reached canonical usage status that I think are all worth some reflection. Pattern …

Looking Back on C#: async and await

With C# 8 on our doorstep, I figure it is a good time to reflect on recent additions to the language that have come before. There are some great improvements you may have missed, some that I really enjoy using, and some I consider have reached canonical usage status that I think are all worth some reflection. …

Looking Back on C# 7: refs enhancements

With C# 8 on our doorstep, I figure it is a good time to reflect on recent additions to the language that have come before. There are some great improvements you may have missed, some that I really enjoy using, and some I consider have reached canonical usage status that I think are all worth some reflection. We talked …

Looking Back on C# 7: Out variables

With C# 8 on our doorstep, I figure it is a good time to reflect on recent additions to the language that have come before. There are some great improvements you may have missed, some that I really enjoy using, and some I consider have reached canonical usage status that I think are all worth some reflection. What are …

Looking Back on C# 7: Local functions

With C# 8 on our doorstep, I figure it is a good time to reflect on recent additions to the language that have come before. There are some great improvements you may have missed, some that I really enjoy using, and some I consider have reached canonical usage status that I think are all worth some reflection. Lambdas - …

Looking Back on C# 7: throw expressions

With C# 8 on our doorstep, I figure it is a good time to reflect on recent additions to the language that have come before. There are some great improvements you may have missed, some that I really enjoy using, and some I consider have reached canonical usage status that I think are all worth some reflection. Throwing …

Looking Back on C# 7: More Expression body members

With C# 8 on our doorstep, I figure it is a good time to reflect on recent additions to the language that have come before. There are some great improvements you may have missed, some that I really enjoy using, and some I consider have reached canonical usage status that I think are all worth some reflection. We …

Looking Back on C# 6: Expression body members

With C# 8 on our doorstep, I figure it is a good time to reflect on recent additions to the language that have come before. There are some great improvements you may have missed, some that I really enjoy using, and some I consider have reached canonical usage status that I think are all worth some reflection. Method …

Looking back on C# 6: Initializers

With C# 8 on our doorstep, I figure it is a good time to reflect on recent additions to the language that have come before. There are some great improvements you may have missed, some that I really enjoy using, and some I consider have reached canonical usage status that I think are all worth some reflection. …

Looking back on C# 6: String interpolation

With C# 8 on our doorstep, I figure it is a good time to reflect on recent additions to the language that have come before. There are some great improvements you may have missed, some that I really enjoy using, and some I consider have reached canonical usage status that I think are all worth some reflection. String …

Looking back on C#

With C# 8 on our doorstep, I figure it is a good time to reflect on recent additions to the language that have come before. There are some great improvements you may have missed, some that I really enjoy using, and some I consider have reached canonical usage status that I think are all worth some reflection. It was …

Looking forward to dotnet in 2019

It’s a new year, and we already have a bunch of dotnet releases to look forward to, thanks to the open development processes that Microsoft is using these days with dotnet. The three big releases I am looking forward to are C# 8 and .Net Core 3.0, and a NetStandard2.1. (Not to mention there is a .Net Framework …

Clean Startup in your AspNetCore

I want to talk about this point made about Keeping a Clean Startup.cs in Asp.Net Core by K. Scott Alan. Mostly I want to agree and elaborate on it. (Warning! I used the British English customised below. If this doesn’t match your sensibilities, just use customize instead.) The Idea The basic idea is that we have …

My C# naming conventions

I have opinions! I’ve been meaning to write this article for a while. I have various opinions about code formatting, and they may or may not conform to the norm. Also, they change occasionally as and when I get a good explanation of why a different way is better, or when I discover a technique while learning a …

.Net Core Series - Self-contained Applications

This is a series on the .Net Core 1.0 bits. Looking for .Net Core 2 Series? Getting Started What’s in the box Using Multiple Projects Testing NuGet Multi-targeting Publishing Portable Applications Self-contained Applications <=(We are here) This was meant to be an article on Self-contained applications in …

There can be only one return; 0 RLY?

My opinions and choices on style of coding evolves and changes over time. By blogging about this now, I can refer back later when I change my mind. I can also elicit the opinions of others to influence me to change my ways if I happen to be wrong and not know it yet. Lets talk about returns. There is an opinion that …

In C#, your structs should be immutable.

I wrote some code. It was simple code. I had a collection. I iterated over the collection and updated the values. I did this several times in an outer loop. The code didn’t work. Why didn’t it work? My collection was an array of Structs. When I pulled an item out in the for loop, it was copied. When I …

Migrating onto dotnet tools 1.0.0

Since Visual Studio 2017 is out, and we have a 1.0.0 tools release for .Net Core, I’m going to try and migrate a simple project from the pre-release tooling, onto the new tooling. The biggest difference is that instead of using a project.json file, the new tooling now uses a .csproj file instead. It will take a …

.Net Core Series - Publishing Portable Applications

This is a series on the .Net Core 1.0 bits. Looking for .Net Core 2 Series? Getting Started What’s in the box Using Multiple Projects Testing NuGet Multi-targeting Publishing Portable Applications <=(We are here) Self-contained Applications We can now take everything we have learned and start publishing our …