Skip to content

Instantly share code, notes, and snippets.

View jonas-lomholdt's full-sized avatar
🚢

Jonas Lomholdt jonas-lomholdt

🚢
View GitHub Profile
@richlander
richlander / modernizing-csharp9.md
Last active April 26, 2024 17:14
Modernizing a codebase for C# 9

Modernizing a codebase for C# 9

There are lots of cases that you can improve. The examples use nullable reference types, but only the WhenNotNull example requires it.

Use the property pattern to replace IsNullorEmpty

Consider adopting the new property pattern, wherever you use IsNullOrEmpty.

string? hello = "hello world";
@shubham90
shubham90 / Dockerfile
Last active January 11, 2024 16:22
Dotnet restore in docker build with private Azure artifacts feed(dotnet sdk >2.1.500 )
# downloading the dotnet sdk image. Could be any docker sdk image with sdk > 2.1.500
FROM microsoft/dotnet:2.1-sdk AS dotnet-builder
ARG FEED_URL
ARG PAT
# download and install latest credential provider. Not required after https://github.com/dotnet/dotnet-docker/issues/878
RUN wget -qO- https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash
#Optional
WORKDIR /workdir
@SidShetye
SidShetye / SerializerAvro
Last active November 5, 2021 11:42
Shows how to use the Apache Avro serializer very easily. It assumes that 1) you have already defined the Avro DTO objects in the Avro IDL 2) You've run those IDL files into the code-generator to create your C# classes 3) You've added these code-gen'd Avro classes to your Visual Studio Project
// Copyright 2013, Sid Shetye
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,