Skip to content

Instantly share code, notes, and snippets.

@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";
@davidwhitney
davidwhitney / setup.ps1
Last active April 10, 2024 10:54
Machine setup chocolatey script
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -n allowGlobalConfirmation
choco install notepad2
choco install notepadplusplus
choco install 7zip
choco install paint.net
choco install autoruns
choco install vcredist140
choco install dotnetfx
# Chocolatey
iex ((new-object net.webclient).DownloadString('http://bit.ly/psChocInstall'))
# install browsers
cinst GoogleChrome
cinst Firefox
cinst GoogleChrome.Canary
cinst Opera
# cinst ie11
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: