!This program cannot be run in DOS mode.
`.rsrc
@.reloc
lSystem.Resources.ResourceReader, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089#System.Resources.RuntimeResourceSet
PADPADP
lSystem.Resources.ResourceReader, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089#System.Resources.RuntimeResourceSet
PADPADP
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="dns-prefetch" href="https://github.githubassets.com/">
<link rel="dns-prefetch" href="https://avatars.githubusercontent.com/">
<link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com/">
<link rel="dns-prefetch" href="https://user-images.githubusercontent.com/">
<link crossorigin="anonymous" media="all" integrity="sha512-J/5cWm5rrVuxkSgldaK1emf5j30Bs5mRgu0uhuHrG+iwf9mD2LOrkQ32SyN5PADLWzkSDxLS3bW/ScsiM44wzw==" rel="stylesheet" href="./GitHub_files/frameworks-27fe5c5a6e6bad5bb191282575a2b57a.css">
<link crossorigin="anonymous" media="all" integrity="sha512-tLF7vl8nbeo3WRDlqIAgYYiEl53NFb2F58kvIEfCYd/Dgq76zXKIhZpEAO9H4wtqaV+0npnvmQF1rjAMq6b1tA==" rel="stylesheet" href="./GitHub_files/behaviors-b4b17bbe5f276dea375910e5a8802061.css">
<link crossorigin="anonymous" media="all" integrity="sha512-iiK72fBJnLBFZ4awdLtCnik7g77ABo26q8xMdxoPOQgAKqV+hpf1UhKAooJegxIq8c0QADlUsKd63HVPgtRNYw==" rel="stylesheet" href="./GitHub_files/github-8a22bbd9f0499cb0456786b074bb429e.css">
<script crossorigin="anonymous" defer="defer" integrity="sha512-CzeY4A6TiG4fGZSWZU8FxmzFFmcQFoPpArF0hkH0/J/S7UL4eed/LKEXMQXfTwiG5yEJBI+9BdKG8KQJNbhcIQ==" type="application/javascript" src="./GitHub_files/environment-0b3798e0.js.download"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-czQZrI8Ar39Oil36WxqNfOBo7pZqlK1CUHWZ8CF9jMxyawHGQ+lKiPtd25OvoNHZF69LfWPpafuwqxcfiG/iYA==" type="application/javascript" src="./GitHub_files/chunk-frameworks-733419ac.js.download"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-YOzkTPNBhsGBHTWNXcjLCxYM3ANDGkp2gejU1oLAxIG4g8VAZJlFYJX2Eo//GCdStAeiby9Y2FecMxmDQwj+Ow==" type="application/javascript" src="./GitHub_files/chunk-vendor-60ece44c.js.download"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-U5w2SuNhe024Q+iVhaZ18HiQCUlgfujDoHEjt9JRP0MRtF4TUhuBd/Ur2yIsgVsM0Q1GSS7yDokYo8unl+F3JQ==" type="application/javascript" src="./GitHub_files/behaviors-539c364a.js.download"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-5tWKSr7mhAzSh4Sx5YRFgKftdGxKwHKnOGYw5DlxjHhkQVURYFU3Bk5IMOGMKuAiJTlC3OXYM3xzGcyjzuEFQQ==" type="application/javascript" data-module-id="./chunk-animate-on-scroll.js" data-src="https://github.githubassets.com/assets/chunk-animate-on-scroll-e6d58a4a.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-0MZorw3oXnKy5eeSwQ9xGrKU4hxQeCXxmyxhneIHNhDIqu8vWh8mHss9FlC75Xd/bPWxFDCvdOo57tnTR46nbA==" type="application/javascript" data-module-id="./chunk-codemirror.js" data-src="https://github.githubassets.com/assets/chunk-codemirror-d0c668af.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-M6W/sGLOuJXCIkw+doDl6zl7J9q2DmqdwftQCtyEiZM/UJNGRVQdyKwI/PAMxD12se/wCx3ZcyJs9nz0o0OSVw==" type="application/javascript" data-module-id="./chunk-color-modes.js" src="./GitHub_files/chunk-color-modes-33a5bfb0.js.download"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-71HZu1T5JWqRNF9wrm2NXZAqYVvzxZ8Dvor5U5l/LuEBbGCBX57Sny60Rj+qUZZAvEBGFlNsz179DEn2HFwgVA==" type="application/javascript" data-module-id="./chunk-confetti.js" data-src="https://github.githubassets.com/assets/chunk-confetti-ef51d9bb.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-P29U0lNmhUj353VrCWp6czdhNpMtF70xVKf4GBGFVKCoqGtxp0sywAM8/46+iC0kdFiRvM13EBvDnq6oyWRwiw==" type="application/javascript" data-module-id="./chunk-contributions-spider-graph.js" data-src="https://github.githubassets.com/assets/chunk-contributions-spider-graph-3f6f54d2.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-6j/oSF+kbW+yetNPvI684VzAu9pzug6Vj2h+3u1LdCuRhR4jnuiHZfeQKls3nxcT/S3H+oIt7FtigE/aeoj+gg==" type="application/javascript" data-module-id="./chunk-drag-drop.js" data-src="https://github.githubassets.com/assets/chunk-drag-drop-ea3fe848.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-VSSd+Yzi2iMS+pibY6hD/WdypxAEdob5F2RMKxuKcAHS2EpFYJPeTXoVxt0NXg03tfj2dka2mEtHS+vjpYSaDw==" type="application/javascript" data-module-id="./chunk-edit-hook-secret-element.js" data-src="https://github.githubassets.com/assets/chunk-edit-hook-secret-element-55249df9.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-XObZgIojqwx94ekra728uVPTHs30O37w4+dNCDNUrZXRnGmFRcitdymWoSEm7ztcvhzboxHmXOSP2TeoPSfQ5Q==" type="application/javascript" data-module-id="./chunk-edit.js" src="./GitHub_files/chunk-edit-5ce6d980.js.download"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-aiqMIGGZGo8AQMjcoImKPMTsZVVRl6htCSY7BpRmpGPG/AF+Wq+P/Oj/dthWQOIk9cCNMPEas7O2zAR6oqn0tA==" type="application/javascript" data-module-id="./chunk-emoji-picker-element.js" data-src="https://github.githubassets.com/assets/chunk-emoji-picker-element-6a2a8c20.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-qqRgtYe+VBe9oQvKTYSA9uVb3qCKhEMl3sHdsnP8AbVRfumjSOugTCEN1YLmnniNBMXb77ty2wddblbKSaQE1Q==" type="application/javascript" data-module-id="./chunk-failbot.js" src="./GitHub_files/chunk-failbot-aaa460b5.js.download"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-YrRWJ3DBTEGQ3kU5vH0Btt+bjUcZHoTj66uIO7wFIfT1LoKJQ0Q2+UTn4rmeKn+PrnMAnQogCNC6Lka17tDncw==" type="application/javascript" data-module-id="./chunk-filter-input.js" data-src="https://github.githubassets.com/assets/chunk-filter-input-62b45627.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-Z1wcyOFQHzyMSPqp5DLKrobr3DN2Q6Dz31cfPtw4b2vPs9PX0PrxyDXHpTbIlcZ9qT1M1BNAypHKKw8Lp6Yx/Q==" type="application/javascript" data-module-id="./chunk-insights-graph.js" data-src="https://github.githubassets.com/assets/chunk-insights-graph-675c1cc8.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-gwtCVvmTqprGdoOWD5qAo64uilYKmDOqEN0XIzMX9KT9u8HabjeF9sk/819qZEcUAZbpzd7gNOU7YW0CDkaEjg==" type="application/javascript" data-module-id="./chunk-insights-query.js" data-src="https://github.githubassets.com/assets/chunk-insights-query-830b4256.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-lmosGyye+/xONUQs9SwGN/a9fQvUSiAFk5HrL8eLHjeuOx9DX9TW5ckRKFD+6FM54vutFf/mBmNFW/0R3KJEBw==" type="application/javascript" data-module-id="./chunk-invitations.js" data-src="https://github.githubassets.com/assets/chunk-invitations-966a2c1b.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-4MxGQhsDODvZgLbu5arO6CapfnNvZ5fXMsZ47FiklUKRmHq4B3h8uTokSIWAOAxsvCMRrZr0DVZ0i0gm3RAnsg==" type="application/javascript" data-module-id="./chunk-jump-to.js" data-src="https://github.githubassets.com/assets/chunk-jump-to-e0cc4642.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-VtdawM/OSsu+d6v25ZY6UcQa/GGLAStSESjsqdEwx+ey88GNYGkQ24o+JFFo4lY+7wLMRf7aCrLxkA5SquBoNQ==" type="application/javascript" data-module-id="./chunk-launch-code-element.js" data-src="https://github.githubassets.com/assets/chunk-launch-code-element-56d75ac0.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-RduaLAviB2ygvRK/eX5iwzYO43ie7svrJ0rYJs06x7XqpRl/IK8PPBscBWM9Moo5Z86DK2iRLE2+aR7TJ5Uc2Q==" type="application/javascript" data-module-id="./chunk-metric-selection-element.js" data-src="https://github.githubassets.com/assets/chunk-metric-selection-element-45db9a2c.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-7hZ031ngiF36wGsfcoyyCWTqwYxjX+qeTLtCV7CJ+IO+wzkzCm1RoR3WzWczfWmwLNqr+Hu3kQOgkBaGn4ntWQ==" type="application/javascript" data-module-id="./chunk-notification-list-focus.js" src="./GitHub_files/chunk-notification-list-focus-ee1674df.js.download"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-ma0OOy3nj0c1cqBx0BkcmIFsLqcSZ+MIukQxyEFM/OWTzZpG+QMgOoWPAHZz43M6fyjAUG1jH6c/6LPiiKPCyw==" type="application/javascript" data-module-id="./chunk-profile-pins-element.js" data-src="https://github.githubassets.com/assets/chunk-profile-pins-element-99ad0e3b.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-hgoSKLTlL8I3IWr/TLONCU+N4kdCtdrHCrrud4NKhgRlLrTw0XUPhqBaDdZUiFSzDQRw/nFQ1kw2VeTm0g9+lA==" type="application/javascript" data-module-id="./chunk-profile.js" data-src="https://github.githubassets.com/assets/chunk-profile-860a1228.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-dmP0pnRItCP7ydEXVipp98lz/HaQtHyG00kfd8lMS5AoLbDwGfqXPjj7Q0qLGpPc7lBkySNNHIeEPF7NblctEA==" type="application/javascript" data-module-id="./chunk-readme-toc-element.js" data-src="https://github.githubassets.com/assets/chunk-readme-toc-element-7663f4a6.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-/fwTpG2i+GCgHEZc/35F+pXdShv1RfJMxyixcTIxzxDdylOWVJvjIWoumYWEPj7gUqBdrWt4SFf989Szmxleaw==" type="application/javascript" data-module-id="./chunk-ref-selector.js" data-src="https://github.githubassets.com/assets/chunk-ref-selector-fdfc13a4.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-D/MxBjtRPjes6DvnYGi2dEH7AQEnLvSvTODabEkSo+1zP6SSEZpb8oF52kFWERA97t1L19fF/P3bn4pgIsMPuA==" type="application/javascript" data-module-id="./chunk-responsive-underlinenav.js" src="./GitHub_files/chunk-responsive-underlinenav-0ff33106.js.download"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-SWy36S28Js+/YzsvYgmp+IEdC0qtMcBf6sYhXTEcj1aFPCLPOTOnOKqzFiNyH2oNVDd+u5Qi8eqYINSIu28LFQ==" type="application/javascript" data-module-id="./chunk-runner-groups.js" data-src="https://github.githubassets.com/assets/chunk-runner-groups-496cb7e9.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-FcH835sK5dmHJmGX2K6Vp4tFq7gUEykUvVXTf+7LmdLoLuYjxIGixOfLxBeCQ+1LDTJ/43bSgqmlDlN0qnGTYQ==" type="application/javascript" data-module-id="./chunk-series-table.js" data-src="https://github.githubassets.com/assets/chunk-series-table-15c1fcdf.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-tk76eoSLUqXSVZ8ANzPprrOImFIV1zQ/VBV+WzG8ZjZpVPH8cLkMH/ur5HJB1lxx9/yo+V2wjDF96t4qfUwZLA==" type="application/javascript" data-module-id="./chunk-severity-calculator-element.js" data-src="https://github.githubassets.com/assets/chunk-severity-calculator-element-b64efa7a.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-j7Pb1H+2Xt4YIKSrJLLXxl/NNkkpW//5PLTpu58JGD8pqRPODDjJKqjO6YPZd++BB4VJubHPjzvuMXhW/9jcqA==" type="application/javascript" data-module-id="./chunk-sortable-behavior.js" data-src="https://github.githubassets.com/assets/chunk-sortable-behavior-8fb3dbd4.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-nKa3UdA2O7Ve4Jn24gaB20yUfJvS7wlnd8Q8C+iWD8i2tXLgaKemDWkLeexeQdrs+an98FCl5fOiy0J+izn+tQ==" type="application/javascript" data-module-id="./chunk-three.module.js" data-src="https://github.githubassets.com/assets/chunk-three.module-9ca6b751.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-WK8VXw3lfUQ/VRW0zlgKPhcMUqH0uTnB/KzePUPdZhCm/HpxfXXHKTGvj5C0Oex7+zbIM2ECzULbtTCT4ug3yg==" type="application/javascript" data-module-id="./chunk-toast.js" data-src="https://github.githubassets.com/assets/chunk-toast-58af155f.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-1vSZvwpr106s8wjSNFNFGVmFT2E4YjI2N8k6JqiSb28GGYMkEJUhveotmvB00Z4bQZM61ZgvWcXax1U3M48gLQ==" type="application/javascript" data-module-id="./chunk-tweetsodium.js" data-src="https://github.githubassets.com/assets/chunk-tweetsodium-d6f499bf.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-UOFNW/xcxynplVfC8Y3fQdFFiasmugYUUHU4N90G8sqBZGL1yR37yjVakxV8/FV5deBALx9OQMBoiba/3OHGDA==" type="application/javascript" data-module-id="./chunk-user-status-submit.js" data-src="https://github.githubassets.com/assets/chunk-user-status-submit-50e14d5b.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-cKu/+X7gT+WVH4sXKt0g3G77bfQfcgwurRObM+dt8XylPm9eEWI+/aWKhVab6VsYuvvuI5BTriKXhXfJwaSXdQ==" type="application/javascript" data-module-id="./chunk-webgl-warp.js" data-src="https://github.githubassets.com/assets/chunk-webgl-warp-70abbff9.js"></script>
<script crossorigin="anonymous" defer="defer" integrity="sha512-W5dFBEQL1e7FdO7OALIe0SYa7GulAAa2GJtDXTxuQctkb69SaEmn10skbbZcYF9GXjWa350XmT+7ofRdxRgzVg==" type="application/javascript" src="./GitHub_files/gist-5b974504.js.download"></script>
<meta name="viewport" content="width=device-width">
<title>Modernizing a codebase for C# 9
GitHub</title>
<meta name="description" content="Modernizing a codebase for C# 9. GitHub Gist: instantly share code, notes, and snippets.">
<link rel="search" type="application/opensearchdescription+xml" href="https://gist.github.com/opensearch-gist.xml" title="Gist">
<link rel="fluid-icon" href="https://gist.github.com/fluidicon.png" title="GitHub">
<meta property="fb:app_id" content="1401488693436528">
<meta name="apple-itunes-app" content="app-id=1477376905">
<meta name="twitter:image:src" content="https://github.githubassets.com/images/modules/gists/gist-og-image.png"><meta name="twitter:site" content="@github"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="Modernizing a codebase for C# 9"><meta name="twitter:description" content="Modernizing a codebase for C# 9. GitHub Gist: instantly share code, notes, and snippets.">
<meta property="og:image" content="https://github.githubassets.com/images/modules/gists/gist-og-image.png"><meta property="og:image:alt" content="Modernizing a codebase for C# 9. GitHub Gist: instantly share code, notes, and snippets."><meta property="og:site_name" content="Gist"><meta property="og:type" content="article"><meta property="og:title" content="Modernizing a codebase for C# 9"><meta property="og:url" content="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de"><meta property="og:description" content="Modernizing a codebase for C# 9. GitHub Gist: instantly share code, notes, and snippets."><meta property="article:author" content="262588213843476"><meta property="article:publisher" content="262588213843476">
<link rel="assets" href="https://github.githubassets.com/">
<meta name="request-id" content="EF86:6FB8:62A7C3:6B07AE:60E588E3" data-pjax-transient="true"><meta name="html-safe-nonce" content="037b8e916cb8b5b5171fc2b5f2c5e83a423b803964004209c5b8edcff022aca1" data-pjax-transient="true"><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRjg2OjZGQjg6NjJBN0MzOjZCMDdBRTo2MEU1ODhFMyIsInZpc2l0b3JfaWQiOiI4NDg0MTM0NTA4MTQ5NzA0OTMxIiwicmVnaW9uX2VkZ2UiOiJmcmEiLCJyZWdpb25fcmVuZGVyIjoiZnJhIn0=" data-pjax-transient="true"><meta name="visitor-hmac" content="1bc7407286becf703b0499ae921e64233605ab4f30e3fc575c3a0eaa815accff" data-pjax-transient="true">
<meta name="github-keyboard-shortcuts" content="" data-pjax-transient="true">
<meta name="selected-link" value="gist_code" data-pjax-transient="">
<meta name="google-site-verification" content="c1kuD-K2HIVF635lypcsWPoD4kilo5-jA_wBFyT4uMY">
<meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">
<meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA">
<meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc">
<meta name="octolytics-host" content="collector.githubapp.com"><meta name="octolytics-app-id" content="gist"><meta name="octolytics-event-url" content="https://collector.githubapp.com/github-external/browser_event">
<meta name="analytics-location" content="/<user-name>/<gist-id>" data-pjax-transient="true">
<meta name="octolytics-dimension-public" content="true"><meta name="octolytics-dimension-gist_id" content="106276029"><meta name="octolytics-dimension-gist_name" content="e3c0031e226ee06481668867955b82de"><meta name="octolytics-dimension-anonymous" content="false"><meta name="octolytics-dimension-owner_id" content="2608468"><meta name="octolytics-dimension-owner_login" content="richlander"><meta name="octolytics-dimension-forked" content="false">
<meta name="hostname" content="gist.github.com">
<meta name="user-login" content="">
<meta name="expected-hostname" content="gist.github.com">
<meta name="enabled-features" content="MARKETPLACE_PENDING_INSTALLATIONS">
<meta http-equiv="x-pjax-version" content="17dc13f850edb217c50cd839fef89181579366237e7eaf49e0c1013c6384882d">
<link href="https://gist.github.com/richlander.atom" rel="alternate" title="atom" type="application/atom+xml">
<link crossorigin="anonymous" media="all" integrity="sha512-MNTs9iGu5Xcf0Bzgk6PUM7zD5fVhhU3VZQt2kHegYrBdtkv0ZKjmlSi4YHNkxO+eDvfNkHmK91JgnqPZ2E/TYA==" rel="stylesheet" href="./GitHub_files/gist-30d4ecf621aee5771fd01ce093a3d433.css">
<meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
<meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
<meta name="browser-optimizely-client-errors-url" content="https://api.github.com/_private/browser/optimizely_client/errors">
<link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000">
<link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon-dark.png">
<link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon-dark.svg">
<meta name="theme-color" content="#1e2327">
<meta name="color-scheme" content="light dark">
<meta name="enabled-homepage-translation-languages" content="">
</head>
<body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
<div class="position-relative js-header-wrapper ">
<a href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de#start-of-content" class="px-2 py-4 color-bg-info-inverse color-text-white show-on-focus js-skip-to-content">Skip to content</a>
<span data-view-component="true" class="progress-pjax-loader width-full js-pjax-loader-bar Progress position-fixed">
<span style="background-color: #79b8ff;width: 0%;" data-view-component="true" class="Progress-item progress-pjax-loader-bar"></span>
</span>
<div class="Header js-details-container Details flex-wrap flex-md-nowrap p-responsive" role="banner">
<div class="Header-item d-none d-md-flex">
<a class="Header-link" data-hotkey="g d" aria-label="Gist Homepage " href="https://gist.github.com/">
<svg class="octicon octicon-mark-github v-align-middle d-inline-block d-md-none" height="24" viewBox="0 0 16 16" version="1.1" width="24" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
<svg height="24" class="octicon octicon-logo-github v-align-middle d-none d-md-inline-block" viewBox="0 0 45 16" version="1.1" width="67" aria-hidden="true"><path fill-rule="evenodd" d="M18.53 12.03h-.02c.009 0 .015.01.024.011h.006l-.01-.01zm.004.011c-.093.001-.327.05-.574.05-.78 0-1.05-.36-1.05-.83V8.13h1.59c.09 0 .16-.08.16-.19v-1.7c0-.09-.08-.17-.16-.17h-1.59V3.96c0-.08-.05-.13-.14-.13h-2.16c-.09 0-.14.05-.14.13v2.17s-1.09.27-1.16.28c-.08.02-.13.09-.13.17v1.36c0 .11.08.19.17.19h1.11v3.28c0 2.44 1.7 2.69 2.86 2.69.53 0 1.17-.17 1.27-.22.06-.02.09-.09.09-.16v-1.5a.177.177 0 00-.146-.18zM42.23 9.84c0-1.81-.73-2.05-1.5-1.97-.6.04-1.08.34-1.08.34v3.52s.49.34 1.22.36c1.03.03 1.36-.34 1.36-2.25zm2.43-.16c0 3.43-1.11 4.41-3.05 4.41-1.64 0-2.52-.83-2.52-.83s-.04.46-.09.52c-.03.06-.08.08-.14.08h-1.48c-.1 0-.19-.08-.19-.17l.02-11.11c0-.09.08-.17.17-.17h2.13c.09 0 .17.08.17.17v3.77s.82-.53 2.02-.53l-.01-.02c1.2 0 2.97.45 2.97 3.88zm-8.72-3.61h-2.1c-.11 0-.17.08-.17.19v5.44s-.55.39-1.3.39-.97-.34-.97-1.09V6.25c0-.09-
<svg height="24" class="octicon octicon-logo-gist v-align-middle d-none d-md-inline-block" viewBox="0 0 25 16" version="1.1" width="37" aria-hidden="true"><path fill-rule="evenodd" d="M4.7 8.73h2.45v4.02c-.55.27-1.64.34-2.53.34-2.56 0-3.47-2.2-3.47-5.05 0-2.85.91-5.06 3.48-5.06 1.28 0 2.06.23 3.28.73V2.66C7.27 2.33 6.25 2 4.63 2 1.13 2 0 4.69 0 8.03c0 3.34 1.11 6.03 4.63 6.03 1.64 0 2.81-.27 3.59-.64V7.73H4.7v1zm6.39 3.72V6.06h-1.05v6.28c0 1.25.58 1.72 1.72 1.72v-.89c-.48 0-.67-.16-.67-.7v-.02zm.25-8.72c0-.44-.33-.78-.78-.78s-.77.34-.77.78.33.78.77.78.78-.34.78-.78zm4.34 5.69c-1.5-.13-1.78-.48-1.78-1.17 0-.77.33-1.34 1.88-1.34 1.05 0 1.66.16 2.27.36v-.94c-.69-.3-1.52-.39-2.25-.39-2.2 0-2.92 1.2-2.92 2.31 0 1.08.47 1.88 2.73 2.08 1.55.13 1.77.63 1.77 1.34 0 .73-.44 1.42-2.06 1.42-1.11 0-1.86-.19-2.33-.36v.94c.5.2 1.58.39 2.33.39 2.38 0 3.14-1.2 3.14-2.41 0-1.28-.53-2.03-2.75-2.23h-.03zm8.58-2.47v-.86h-2.42v-2.5l-1.08.31v2.11l-1.56.44v.48h1.56v5c0 1.53 1.19 2.13 2.5 2.13.19 0 .52-.02.69-.05v-.89c-.19.03-.41.0
</div>
<div class="Header-item d-md-none">
<button class="Header-link btn-link js-details-target" type="button" aria-label="Toggle navigation" aria-expanded="false">
<svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="24" width="24" class="octicon octicon-three-bars">
<path fill-rule="evenodd" d="M1 2.75A.75.75 0 011.75 2h12.5a.75.75 0 110 1.5H1.75A.75.75 0 011 2.75zm0 5A.75.75 0 011.75 7h12.5a.75.75 0 110 1.5H1.75A.75.75 0 011 7.75zM1.75 12a.75.75 0 100 1.5h12.5a.75.75 0 100-1.5H1.75z"></path>
</svg>
</button>
</div>
<div class="Header-item Header-item--full js-site-search flex-column flex-md-row width-full flex-order-2 flex-md-order-none mr-0 mr-md-3 mt-3 mt-md-0 Details-content--hidden-not-important d-md-flex">
<div class="header-search flex-self-stretch flex-md-self-auto mr-0 mr-md-3 mb-3 mb-md-0">
<!-- '"` --><!-- </textarea></xmp> --><form class="position-relative js-quicksearch-form" role="search" aria-label="Site" action="https://gist.github.com/search" accept-charset="UTF-8" method="get">
<div class="header-search-wrapper form-control input-sm js-chromeless-input-container">
<input type="text" class="form-control input-sm js-site-search-focus header-search-input" data-hotkey="s,/" name="q" aria-label="Search" placeholder="Search
" autocorrect="off" autocomplete="off" autocapitalize="off">
</div>
</form></div>
<nav aria-label="Global" class="d-flex flex-column flex-md-row flex-self-stretch flex-md-self-auto">
<a class="Header-link mr-0 mr-md-3 py-2 py-md-0 border-top border-md-top-0 border-white-fade" data-ga-click="Header, go to all gists, text:all gists" href="https://gist.github.com/discover">All gists</a>
<a class="Header-link mr-0 mr-md-3 py-2 py-md-0 border-top border-md-top-0 border-white-fade" data-ga-click="Header, go to GitHub, text:Back to GitHub" href="https://github.com/">Back to GitHub</a>
<a class="Header-link d-block d-md-none mr-0 mr-md-3 py-2 py-md-0 border-top border-md-top-0 border-white-fade" data-ga-click="Header, sign in" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"gist header","repository_id":null,"auth_type":"LOG_IN","originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="cea35e53507dee1234a728596fb5470ba01a8a905a8e1d4e4ec8d6707753c9ba" href="https://gist.github.com/auth/github?return_to=https%3A%2F%2Fgist.github.com%2Frichlander%2Fe3c0031e226ee06481668867955b82de">
Sign in
<a class="Header-link d-block d-md-none mr-0 mr-md-3 py-2 py-md-0 border-top border-md-top-0 border-white-fade" data-ga-click="Header, sign up" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"gist header","repository_id":null,"auth_type":"SIGN_UP","originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="640ba14376d9b5e740726727e99eeb353816c34e222893751aff83cd2334b0a7" href="https://gist.github.com/join?return_to=https%3A%2F%2Fgist.github.com%2Frichlander%2Fe3c0031e226ee06481668867955b82de&source=header-gist">
Sign up
</a></nav>
</div>
<div class="Header-item Header-item--full flex-justify-center d-md-none position-relative">
<a class="Header-link" data-hotkey="g d" aria-label="Gist Homepage " href="https://gist.github.com/">
<svg class="octicon octicon-mark-github v-align-middle d-inline-block d-md-none" height="24" viewBox="0 0 16 16" version="1.1" width="24" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
<svg height="24" class="octicon octicon-logo-github v-align-middle d-none d-md-inline-block" viewBox="0 0 45 16" version="1.1" width="67" aria-hidden="true"><path fill-rule="evenodd" d="M18.53 12.03h-.02c.009 0 .015.01.024.011h.006l-.01-.01zm.004.011c-.093.001-.327.05-.574.05-.78 0-1.05-.36-1.05-.83V8.13h1.59c.09 0 .16-.08.16-.19v-1.7c0-.09-.08-.17-.16-.17h-1.59V3.96c0-.08-.05-.13-.14-.13h-2.16c-.09 0-.14.05-.14.13v2.17s-1.09.27-1.16.28c-.08.02-.13.09-.13.17v1.36c0 .11.08.19.17.19h1.11v3.28c0 2.44 1.7 2.69 2.86 2.69.53 0 1.17-.17 1.27-.22.06-.02.09-.09.09-.16v-1.5a.177.177 0 00-.146-.18zM42.23 9.84c0-1.81-.73-2.05-1.5-1.97-.6.04-1.08.34-1.08.34v3.52s.49.34 1.22.36c1.03.03 1.36-.34 1.36-2.25zm2.43-.16c0 3.43-1.11 4.41-3.05 4.41-1.64 0-2.52-.83-2.52-.83s-.04.46-.09.52c-.03.06-.08.08-.14.08h-1.48c-.1 0-.19-.08-.19-.17l.02-11.11c0-.09.08-.17.17-.17h2.13c.09 0 .17.08.17.17v3.77s.82-.53 2.02-.53l-.01-.02c1.2 0 2.97.45 2.97 3.88zm-8.72-3.61h-2.1c-.11 0-.17.08-.17.19v5.44s-.55.39-1.3.39-.97-.34-.97-1.09V6.25c0-.09-
<svg height="24" class="octicon octicon-logo-gist v-align-middle d-none d-md-inline-block" viewBox="0 0 25 16" version="1.1" width="37" aria-hidden="true"><path fill-rule="evenodd" d="M4.7 8.73h2.45v4.02c-.55.27-1.64.34-2.53.34-2.56 0-3.47-2.2-3.47-5.05 0-2.85.91-5.06 3.48-5.06 1.28 0 2.06.23 3.28.73V2.66C7.27 2.33 6.25 2 4.63 2 1.13 2 0 4.69 0 8.03c0 3.34 1.11 6.03 4.63 6.03 1.64 0 2.81-.27 3.59-.64V7.73H4.7v1zm6.39 3.72V6.06h-1.05v6.28c0 1.25.58 1.72 1.72 1.72v-.89c-.48 0-.67-.16-.67-.7v-.02zm.25-8.72c0-.44-.33-.78-.78-.78s-.77.34-.77.78.33.78.77.78.78-.34.78-.78zm4.34 5.69c-1.5-.13-1.78-.48-1.78-1.17 0-.77.33-1.34 1.88-1.34 1.05 0 1.66.16 2.27.36v-.94c-.69-.3-1.52-.39-2.25-.39-2.2 0-2.92 1.2-2.92 2.31 0 1.08.47 1.88 2.73 2.08 1.55.13 1.77.63 1.77 1.34 0 .73-.44 1.42-2.06 1.42-1.11 0-1.86-.19-2.33-.36v.94c.5.2 1.58.39 2.33.39 2.38 0 3.14-1.2 3.14-2.41 0-1.28-.53-2.03-2.75-2.23h-.03zm8.58-2.47v-.86h-2.42v-2.5l-1.08.31v2.11l-1.56.44v.48h1.56v5c0 1.53 1.19 2.13 2.5 2.13.19 0 .52-.02.69-.05v-.89c-.19.03-.41.0
</div>
<div class="Header-item f4 mr-0" role="navigation">
<a class="HeaderMenu-link no-underline mr-3" data-ga-click="Header, sign in" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"gist header","repository_id":null,"auth_type":"LOG_IN","originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="cea35e53507dee1234a728596fb5470ba01a8a905a8e1d4e4ec8d6707753c9ba" href="https://gist.github.com/auth/github?return_to=https%3A%2F%2Fgist.github.com%2Frichlander%2Fe3c0031e226ee06481668867955b82de">
Sign in
</a> <a class="HeaderMenu-link d-inline-block no-underline border color-border-tertiary rounded px-2 py-1" data-ga-click="Header, sign up" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"gist header","repository_id":null,"auth_type":"SIGN_UP","originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="640ba14376d9b5e740726727e99eeb353816c34e222893751aff83cd2334b0a7" href="https://gist.github.com/join?return_to=https%3A%2F%2Fgist.github.com%2Frichlander%2Fe3c0031e226ee06481668867955b82de&source=header-gist">
Sign up
</a> </div>
</div>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div data-pjax-replace="" id="js-flash-container">
<template class="js-flash-template"></template>
</div>
<include-fragment class="js-notification-shelf-include-fragment" data-base-src="https://github.com/notifications/beta/shelf"></include-fragment>
<div class="application-main " data-commit-hovercards-enabled="" data-discussion-hovercards-enabled="" data-issue-and-pr-hovercards-enabled="">
<div itemscope="" itemtype="http://schema.org/Code">
<main id="gist-pjax-container" data-pjax-container="">
<div class="gist-detail-intro gist-banner pb-3">
<div class="text-center container-lg px-3">
<p class="lead">
Instantly share code, notes, and snippets.
</p>
</div>
</div>
<div class="gisthead pagehead color-bg-secondary pb-0 pt-3 mb-4">
<div class="px-0">
<div class="mb-3 d-flex px-3 px-md-3 px-lg-5">
<div class="flex-auto min-width-0 width-fit mr-3">
<div class="d-flex">
<div class="d-none d-md-block">
<a class="avatar mr-2 flex-shrink-0" data-hovercard-type="user" data-hovercard-url="/users/richlander/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://gist.github.com/richlander"><img class=" avatar-user" src="./GitHub_files/2608468" width="32" height="32" alt="@richlander"></a>
</div>
<div class="d-flex flex-column">
<h1 class="break-word f3 text-normal mb-md-0 mb-1">
<span class="author"><a data-hovercard-type="user" data-hovercard-url="/users/richlander/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://gist.github.com/richlander">richlander</a></span><!--
--><span class="mx-1 color-text-secondary">/</span><!--
--><strong itemprop="name" class="css-truncate-target mr-1" style="max-width: 410px"><a href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de">modernizing-csharp9.md</a></strong>
</h1>
<div class="note m-0">
Last active <time-ago datetime="2021-07-03T12:15:34Z" data-view-component="true" class="no-wrap" title="Jul 3, 2021, 3:15 PM GMT+3">4 days ago</time-ago>
</div>
</div>
</div>
</div>
<ul class="d-md-flex d-none pagehead-actions float-none">
<li>
<a class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to star a gist" rel="nofollow" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"gist star button","repository_id":null,"auth_type":"LOG_IN","originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="b02e778d4218be96920953fc9b7690f68c0a07c3b36016dbec8918fead1777e6" href="https://gist.github.com/login?return_to=https%3A%2F%2Fgist.github.com%2Frichlander%2Fe3c0031e226ee06481668867955b82de">
<svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-star">
<path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"></path>
</svg>
Star
<a class="social-count" aria-label="92 users starred this gist" href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de/stargazers">
92
</li>
<li>
<a class="btn btn-sm btn-with-count tooltipped tooltipped-n" aria-label="You must be signed in to fork a gist" rel="nofollow" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"gist fork button","repository_id":null,"auth_type":"LOG_IN","originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="34e33a0ac6b1be0728d8f1c03ce05f00db3fac261e9fcdf59d750587cf3bd620" href="https://gist.github.com/login?return_to=https%3A%2F%2Fgist.github.com%2Frichlander%2Fe3c0031e226ee06481668867955b82de">
<svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-repo-forked">
<path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path>
</svg>
Fork
</a> <a class="social-count js-social-count" href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de/forks" aria-label="6 users forked this gist">
6
</a>
</li>
</ul>
</div>
<div class="d-block d-md-none px-3 px-md-3 px-lg-5 mb-3">
<a class="btn btn-sm btn-block tooltipped tooltipped-n" aria-label="You must be signed in to star a gist" rel="nofollow" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"gist star button","repository_id":null,"auth_type":"LOG_IN","originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="b02e778d4218be96920953fc9b7690f68c0a07c3b36016dbec8918fead1777e6" href="https://gist.github.com/login?return_to=https%3A%2F%2Fgist.github.com%2Frichlander%2Fe3c0031e226ee06481668867955b82de">
<svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-star">
<path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"></path>
</svg>
Star
</div>
<div class="d-flex flex-md-row flex-column px-0 pr-md-3 px-lg-5">
<div class="flex-md-order-1 flex-order-2 flex-auto">
<nav class="UnderlineNav box-shadow-none px-3 px-lg-0 " aria-label="Gist" data-pjax="#gist-pjax-container">
<div class="UnderlineNav-body">
<a class="js-selected-navigation-item selected UnderlineNav-item" data-pjax="true" data-hotkey="g c" aria-current="page" data-selected-links="gist_code /richlander/e3c0031e226ee06481668867955b82de" href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de">
<svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-code UnderlineNav-octicon">
<path fill-rule="evenodd" d="M4.72 3.22a.75.75 0 011.06 1.06L2.06 8l3.72 3.72a.75.75 0 11-1.06 1.06L.47 8.53a.75.75 0 010-1.06l4.25-4.25zm6.56 0a.75.75 0 10-1.06 1.06L13.94 8l-3.72 3.72a.75.75 0 101.06 1.06l4.25-4.25a.75.75 0 000-1.06l-4.25-4.25z"></path>
</svg>
Code
<a class="js-selected-navigation-item UnderlineNav-item" data-pjax="true" data-hotkey="g r" data-selected-links="gist_revisions /richlander/e3c0031e226ee06481668867955b82de/revisions" href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de/revisions">
<svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-git-commit">
<path fill-rule="evenodd" d="M10.5 7.75a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm1.43.75a4.002 4.002 0 01-7.86 0H.75a.75.75 0 110-1.5h3.32a4.001 4.001 0 017.86 0h3.32a.75.75 0 110 1.5h-3.32z"></path>
</svg>
Revisions
<span title="38" data-view-component="true" class="Counter hx_reponav_item_counter">38</span>
<a class="js-selected-navigation-item UnderlineNav-item" data-pjax="true" data-hotkey="g s" data-selected-links="gist_stars /richlander/e3c0031e226ee06481668867955b82de/stargazers" href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de/stargazers">
<svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-star">
<path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"></path>
</svg>
Stars
<span title="92" data-view-component="true" class="Counter hx_reponav_item_counter">92</span>
<a class="js-selected-navigation-item UnderlineNav-item" data-pjax="true" data-hotkey="g f" data-selected-links="gist_forks /richlander/e3c0031e226ee06481668867955b82de/forks" href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de/forks">
<svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-git-branch">
<path fill-rule="evenodd" d="M11.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V6A2.5 2.5 0 0110 8.5H6a1 1 0 00-1 1v1.128a2.251 2.251 0 11-1.5 0V5.372a2.25 2.25 0 111.5 0v1.836A2.492 2.492 0 016 7h4a1 1 0 001-1v-.628A2.25 2.25 0 019.5 3.25zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zM3.5 3.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0z"></path>
</svg>
Forks
<span title="6" data-view-component="true" class="Counter hx_reponav_item_counter">6</span>
</a> </div>
</nav>
</div>
<div class="d-md-flex d-none flex-items-center flex-md-order-2 flex-order-1 file-navigation-options" data-multiple="">
<div class="d-lg-table d-none">
<div class="file-navigation-option v-align-middle">
<div class="d-md-flex d-none">
<div class="input-group">
<div class="input-group-button">
<details class="details-reset details-overlay select-menu">
<summary class="btn btn-sm select-menu-button" data-ga-click="Repository, clone Embed, location:repo overview" aria-haspopup="menu" role="button">
<span data-menu-button="">Embed</span>
</summary>
<details-menu class="select-menu-modal position-absolute" data-menu-input="gist-share-url" style="z-index: 99;" aria-label="Clone options" role="menu">
<div class="select-menu-header">
<span class="select-menu-title">What would you like to do?</span>
</div>
<div class="select-menu-list">
<button name="button" type="button" class="select-menu-item width-full" aria-checked="true" role="menuitemradio" value="<script src="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de.js"></script>" data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"EMBED","git_repository_type":"GIST","gist_id":106276029,"originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="92e8919558546d09dfc4d60b90b80ace7f526e28674819c157fd1f9d626c824e">
<svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-check select-menu-item-icon">
<path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path>
</svg>
<div class="select-menu-item-text">
<span class="select-menu-item-heading" data-menu-button-text="">
Embed
</span>
<span class="description">
Embed this gist in your website.
</span>
</div>
</button> <button name="button" type="button" class="select-menu-item width-full" aria-checked="false" role="menuitemradio" value="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de" data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"SHARE","git_repository_type":"GIST","gist_id":106276029,"originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="bf1eda130d36d8cf2e9c2e5680aa6111b37e3948429af531a9c0ace65ee99cea">
<svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-check select-menu-item-icon">
<path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path>
</svg>
<div class="select-menu-item-text">
<span class="select-menu-item-heading" data-menu-button-text="">
Share
</span>
<span class="description">
Copy sharable link for this gist.
</span>
</div>
</button> <button name="button" type="button" class="select-menu-item width-full" aria-checked="false" role="menuitemradio" value="https://gist.github.com/e3c0031e226ee06481668867955b82de.git" data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"USE_HTTPS","git_repository_type":"GIST","gist_id":106276029,"originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="6e54d3afe4fe0f5e40a66114e322a1daba96929f5e3d100b03e698f96c42f830">
<svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-check select-menu-item-icon">
<path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path>
</svg>
<div class="select-menu-item-text">
<span class="select-menu-item-heading" data-menu-button-text="">
Clone via
HTTPS
</span>
<span class="description">
Clone with Git or checkout with SVN using the repository
s web address.
</span>
</div>
</button> </div>
<div class="select-menu-list">
<a role="link" class="select-menu-item select-menu-action" href="https://docs.github.com/articles/which-remote-url-should-i-use" target="_blank">
<svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-question select-menu-item-icon">
<path fill-rule="evenodd" d="M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9 3a1 1 0 11-2 0 1 1 0 012 0zM6.92 6.085c.081-.16.19-.299.34-.398.145-.097.371-.187.74-.187.28 0 .553.087.738.225A.613.613 0 019 6.25c0 .177-.04.264-.077.318a.956.956 0 01-.277.245c-.076.051-.158.1-.258.161l-.007.004a7.728 7.728 0 00-.313.195 2.416 2.416 0 00-.692.661.75.75 0 001.248.832.956.956 0 01.276-.245 6.3 6.3 0 01.26-.16l.006-.004c.093-.057.204-.123.313-.195.222-.149.487-.355.692-.662.214-.32.329-.702.329-1.15 0-.76-.36-1.348-.863-1.725A2.76 2.76 0 008 4c-.631 0-1.155.16-1.572.438-.413.276-.68.638-.849.977a.75.75 0 101.342.67z"></path>
</svg>
<div class="select-menu-item-text">
Learn more about clone URLs
</div>
</a>
</div>
</details-menu>
</details>
</div>
<input id="gist-share-url" type="text" data-autoselect="" class="form-control input-monospace input-sm" value="<script src="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de.js"></script>" aria-label="Clone this repository at <script src="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de.js"></script>" readonly="">
<div class="input-group-button">
<clipboard-copy for="gist-share-url" aria-label="Copy to clipboard" class="btn btn-sm zeroclipboard-button" data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"COPY_URL","git_repository_type":"GIST","gist_id":106276029,"originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="05cdbe18fe510ffc786124f6c1621442b04b12585ae0a83fd9016c2347ce70d8" tabindex="0" role="button"><svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-clippy">
<path fill-rule="evenodd" d="M5.75 1a.75.75 0 00-.75.75v3c0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75v-3a.75.75 0 00-.75-.75h-4.5zm.75 3V2.5h3V4h-3zm-2.874-.467a.75.75 0 00-.752-1.298A1.75 1.75 0 002 3.75v9.5c0 .966.784 1.75 1.75 1.75h8.5A1.75 1.75 0 0014 13.25v-9.5a1.75 1.75 0 00-.874-1.515.75.75 0 10-.752 1.298.25.25 0 01.126.217v9.5a.25.25 0 01-.25.25h-8.5a.25.25 0 01-.25-.25v-9.5a.25.25 0 01.126-.217z"></path>
</svg></clipboard-copy>
</div>
</div>
</div>
</div>
</div>
<div class="ml-2 file-navigation-option">
<a class="btn btn-sm tooltipped tooltipped-s tooltipped-multiline js-remove-unless-platform" data-platforms="windows,mac" aria-label="Save richlander/e3c0031e226ee06481668867955b82de to your computer and use it in GitHub Desktop." data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"OPEN_IN_DESKTOP","git_repository_type":"GIST","gist_id":106276029,"originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="ecb846ada44af342e9dc0d0c80556fc3b6116594d2e2ba8450337c79bf59e6bd" href="https://desktop.github.com/"><svg aria-hidden="true" viewBox="0 0 16 16" version="1.1" data-view-component="true" height="16" width="16" class="octicon octicon-desktop-download">
<path d="M4.927 5.427l2.896 2.896a.25.25 0 00.354 0l2.896-2.896A.25.25 0 0010.896 5H8.75V.75a.75.75 0 10-1.5 0V5H5.104a.25.25 0 00-.177.427z"></path><path d="M1.573 2.573a.25.25 0 00-.073.177v7.5a.25.25 0 00.25.25h12.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-3a.75.75 0 110-1.5h3A1.75 1.75 0 0116 2.75v7.5A1.75 1.75 0 0114.25 12h-3.727c.099 1.041.52 1.872 1.292 2.757A.75.75 0 0111.25 16h-6.5a.75.75 0 01-.565-1.243c.772-.885 1.192-1.716 1.292-2.757H1.75A1.75 1.75 0 010 10.25v-7.5A1.75 1.75 0 011.75 1h3a.75.75 0 010 1.5h-3a.25.25 0 00-.177.073zM6.982 12a5.72 5.72 0 01-.765 2.5h3.566a5.72 5.72 0 01-.765-2.5H6.982z"></path>
</svg></a>
</div>
<div class="ml-2">
<a class="btn btn-sm" rel="nofollow" data-hydro-click="{"event_type":"clone_or_download.click","payload":{"feature_clicked":"DOWNLOAD_ZIP","git_repository_type":"GIST","gist_id":106276029,"originating_url":"https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de","user_id":null}}" data-hydro-click-hmac="670612036c17fb99a906d22eb905c458e9f81c77fbb034afc0053a054778db1e" data-ga-click="Gist, download zip, location:gist overview" href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de/archive/7fcc4aed117517be1f7c7ac7dde768ac98a3c266.zip">Download ZIP</a>
</div>
</div>
</div>
</div>
</div>
<div class="container-lg px-3 new-discussion-timeline">
<div class="repository-content gist-content">
<div>
<div itemprop="about">
Modernizing a codebase for C# 9
</div>
<div class="js-gist-file-update-container js-task-list-container file-box">
<div id="file-modernizing-csharp9-md" class="file my-2">
<div class="file-header d-flex flex-md-items-center flex-items-start">
<div class="file-actions flex-order-2 pt-0">
<a href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de/raw/7fcc4aed117517be1f7c7ac7dde768ac98a3c266/modernizing-csharp9.md" role="button" data-view-component="true" class="btn-sm btn">
</div>
<div class="file-info pr-4 d-flex flex-md-items-center flex-items-start flex-order-1 flex-auto">
<span class="mr-1">
<svg class="octicon octicon-code-square color-icon-secondary" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M1.75 1.5a.25.25 0 00-.25.25v12.5c0 .138.112.25.25.25h12.5a.25.25 0 00.25-.25V1.75a.25.25 0 00-.25-.25H1.75zM0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0114.25 16H1.75A1.75 1.75 0 010 14.25V1.75zm9.22 3.72a.75.75 0 000 1.06L10.69 8 9.22 9.47a.75.75 0 101.06 1.06l2-2a.75.75 0 000-1.06l-2-2a.75.75 0 00-1.06 0zM6.78 6.53a.75.75 0 00-1.06-1.06l-2 2a.75.75 0 000 1.06l2 2a.75.75 0 101.06-1.06L5.31 8l1.47-1.47z"></path></svg>
</span>
<a class="wb-break-all" href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de#file-modernizing-csharp9-md">
<strong class="user-select-contain gist-blob-name css-truncate-target">
modernizing-csharp9.md
</strong>
</a>
</div>
</div>
<div id="file-modernizing-csharp9-md-readme" class="Box-body readme blob js-code-block-container p-5 p-xl-6 gist-border-0">
<article class="markdown-body entry-content container-lg" itemprop="text"><h1><a id="user-content-modernizing-a-codebase-for-c-9" class="anchor" aria-hidden="true" href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de#modernizing-a-codebase-for-c-9"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Modernizing a codebase for C# 9</h1>
<p>There are lots of cases that you can improve. The examples use nullable reference types, but only the <code>WhenNotNull</code> example requires it.</p>
<h2><a id="user-content-use-the-property-pattern-to-replace-isnullorempty" class="anchor" aria-hidden="true" href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de#use-the-property-pattern-to-replace-isnullorempty"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Use the property pattern to replace <code>IsNullorEmpty</code></h2>
<p>Consider adopting the new property pattern, wherever you use <code>IsNullOrEmpty</code>.</p>
<div class="highlight highlight-source-cs"><pre><span class="pl-k">string</span>? <span class="pl-en">hello</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>hello world<span class="pl-pds">"</span></span>;
<span class="pl-smi">hello</span> <span class="pl-k">=</span> <span class="pl-c1">null</span>;
<span class="pl-c"><span class="pl-c">//</span> Old approach</span>
<span class="pl-k">if</span> (<span class="pl-k">!</span><span class="pl-smi">string</span>.<span class="pl-en">IsNullOrEmpty</span>(<span class="pl-smi">hello</span>))
<span class="pl-smi">Console</span>.<span class="pl-en">WriteLine</span>(<span class="pl-s"><span class="pl-pds">$"</span>{<span class="pl-smi">hello</span>} has {<span class="pl-smi">hello</span>.<span class="pl-smi">Length</span>} letters.<span class="pl-pds">"</span></span>);
<span class="pl-c"><span class="pl-c">//</span> New approach, with a property pattern</span>
<span class="pl-k">if</span> (<span class="pl-smi">hello</span> <span class="pl-k">is</span> { <span class="pl-smi">Length</span>: <span class="pl-k">></span><span class="pl-c1">0</span> })
<span class="pl-smi">Console</span>.<span class="pl-en">WriteLine</span>(<span class="pl-s"><span class="pl-pds">$"</span>{<span class="pl-smi">hello</span>} has {<span class="pl-smi">hello</span>.<span class="pl-smi">Length</span>} letters.<span class="pl-pds">"</span></span>);
}</pre></div>
<p>You can use a similar super-powered set of checks on arrays. Note that the "Old approach" isn't compatible with nullability, but the "New approach" is. It is due to the compiler only tracking variables not array indices.</p>
<div class="highlight highlight-source-cs"><pre><span class="pl-c"><span class="pl-c">//</span> For arrays</span>
<span class="pl-k">string</span>?[]? <span class="pl-en">greetings</span> <span class="pl-k">=</span> <span class="pl-k">new</span> <span class="pl-k">string</span>[<span class="pl-c1">2</span>];
<span class="pl-smi">greetings</span>[<span class="pl-c1">0</span>] <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>Hello world<span class="pl-pds">"</span></span>;
<span class="pl-smi">greetings</span> <span class="pl-k">=</span> <span class="pl-c1">null</span>;
<span class="pl-c"><span class="pl-c">//</span> Old approach</span>
<span class="pl-k">if</span> (<span class="pl-smi">greetings</span> <span class="pl-k">!=</span> <span class="pl-c1">null</span> <span class="pl-k">&&</span> <span class="pl-k">!</span><span class="pl-smi">string</span>.<span class="pl-en">IsNullOrEmpty</span>(<span class="pl-smi">greetings</span>[<span class="pl-c1">0</span>]))
<span class="pl-smi">Console</span>.<span class="pl-en">WriteLine</span>(<span class="pl-s"><span class="pl-pds">$"</span>{<span class="pl-smi">greetings</span>[<span class="pl-c1">0</span>]} has {<span class="pl-smi">greetings</span>[<span class="pl-c1">0</span>].<span class="pl-smi">Length</span>} letters.<span class="pl-pds">"</span></span>);
<span class="pl-c"><span class="pl-c">//</span> New approach</span>
<span class="pl-k">if</span> (<span class="pl-smi">greetings</span><span class="pl-k">?</span>[<span class="pl-c1">0</span>] <span class="pl-k">is</span> {<span class="pl-smi">Length</span>: <span class="pl-k">></span> <span class="pl-c1">0</span>} <span class="pl-smi">hi</span>)
<span class="pl-smi">Console</span>.<span class="pl-en">WriteLine</span>(<span class="pl-s"><span class="pl-pds">$"</span>{<span class="pl-smi">hi</span>} has {<span class="pl-smi">hi</span>.<span class="pl-smi">Length</span>} letters.<span class="pl-pds">"</span></span>);
}</pre></div>
<p>Here is some related code experiments on nullability and arrays: <a href="https://gist.github.com/richlander/ca6567039906da4e1fcfba557b6ccb63">https://gist.github.com/richlander/ca6567039906da4e1fcfba557b6ccb63</a></p>
<h2><a id="user-content-simplify-checks-to-multiple-constant-values" class="anchor" aria-hidden="true" href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de#simplify-checks-to-multiple-constant-values"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Simplify checks to multiple constant values</h2>
<p>You can now test a value against multiple constant values.</p>
<div class="highlight highlight-source-cs"><pre><span class="pl-k">ConsoleKeyInfo</span> <span class="pl-en">userInput</span> <span class="pl-k">=</span> <span class="pl-smi">Console</span>.<span class="pl-en">ReadKey</span>();
<span class="pl-c"><span class="pl-c">//</span> Old approach</span>
<span class="pl-k">if</span> (<span class="pl-smi">userInput</span>.<span class="pl-smi">KeyChar</span> <span class="pl-k">==</span> <span class="pl-s">'Y'</span> <span class="pl-k">||</span> <span class="pl-smi">userInput</span>.<span class="pl-smi">KeyChar</span> <span class="pl-k">==</span> <span class="pl-s">'y'</span>)
<span class="pl-smi">Console</span>.<span class="pl-en">WriteLine</span>(<span class="pl-s"><span class="pl-pds">"</span>Do something.<span class="pl-pds">"</span></span>);
<span class="pl-c"><span class="pl-c">//</span> New approach with a logical pattern</span>
<span class="pl-k">if</span> (<span class="pl-smi">userInput</span>.<span class="pl-smi">KeyChar</span> <span class="pl-k">is</span> <span class="pl-s">'Y'</span> <span class="pl-smi">or</span> <span class="pl-s">'y'</span>)
<span class="pl-smi">Console</span>.<span class="pl-en">WriteLine</span>(<span class="pl-s"><span class="pl-pds">"</span>Do something.<span class="pl-pds">"</span></span>);
}</pre></div>
<h2><a id="user-content-use-notnullwhen-for-bool-return-methods-with-nullable-out-parameters" class="anchor" aria-hidden="true" href="https://gist.github.com/richlander/e3c0031e226ee06481668867955b82de#use-notnullwhen-for-bool-return-methods-with-nullable-out-parameters"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Use <code>NotNullWhen</code> for bool return methods with nullable out parameters</h2>
<p>You can make it easy to call methods that return <code>bool</code> and whose signature include an <code>out</code> param with a nullable annotation, using the <a href="https://docs.microsoft.com/dotnet/api/system.diagnostics.codeanalysis.notnullwhenattribute" rel="nofollow">NotNullWhen</a> attribute. In the typical pattern, the attribute tells the compiler that the out parameter is set when the return value is <code>true</code>. In that case, you don't have to check the out parameter for a null reference, if you guard the use of the reference within an <code>if</code> statement, conditional on the return value.</p>
<p>You can search a codebase for this pattern with the following regex, to find opportunities to use <code>NotNullWhen</code>.</p>
5E,Cx2
B[`lKl
l'/n3:
27;-FG1
Ib("|tFm
)b=+'AE
a:73@I
Nt}hG)
#3nMa[
~U@qrO
toeTCf
l{ =9g
-3,/aI*A
I_SW/cX7D2
iM$_q$
ztz1<!
UjjZJ3
c/3^H7h
E25JQ;B
5.)vSh
^5MS`G
!.CX+>
Mei0LKR
tCJ()<
(2+Z,]
cIJ~JqUQhV
A@,wi"
Aq"ttR
n,$u$hgk
(F\*y-
'|& 5S6
Y8"m,<:W
jiypZZ
B?IBHH
tc2G+y
-zaU#*
LP`7#w/2D
^70\;7zR|
`3&_1(
9Oj`^-
j9T~+x
k+[0+w
msj;t&=
b[J2chB
[}+/A
6;a7k(
U}VF`f
sAT0xkG
~|.*yT
~o2ruE
v@`/U1
|{"sFj
v*O!';
|,}"{*
Kr)|%@
0%xX>E
]%,{pbA
d23QG[
hNJEro
@No@&caq
@:U1)>\
?[@eDy
V!6s\i}J
KZH:zH
ZtcJ*!
CZ'dS-
k.U.$5
bepWzv
<9[<!+
L3VoD(
$Zg_MK&
PpjF?T
Jp9AI8
mCnP:C
b7lx}u
1?f-A1
G^s$,3
^gNBcLM
4|_4S,
V)R\[D
t3J3Gc'
F`t]n_
BR3<c
x:8kF6 czr
vlB#uW
L&nGPD
.hr~sE
I?un~!
KVrML0`
j^[&@
4vOhk` <`
/Tp9;%`
lz<2ho
D5My&+
>wHc9:]E
?Ys::4
,OTO6@msb
<Z@BM1
1hNkE[
G@Bx]W
2&':AfP
a"ORRM
)rw/C0;
iMVX)6
%SWJTN/
3hVlf"
J#:t9Hs
rmI&GY
Ijw%B/Z]nG
Y tS%
?T "ej;
E86J"Wn
`bBT:rz
vP^Vl(Cv
bg6fj<
E/=xp?74rY
5jW3\M
#rZ[jzb}
9.C.H'
Ha^$bM
K<(n\:9
n>|57q=
d{^~{U
%"=L91
&V~fh}
$pd4jp
fLp1an?o
ruh-75k+
J ~,4%s|
zdS0-t
UggM!
-))YXw<
Ia{1P
72\;6_
oGg4WrH
B4`E8e
hU,.{l
V3:jj%
y I2>ag
6'4d.z
MuHd9b
!.(+&9
D,)||mW
9@oKry\ee3
8cJc_{
d_xw%Z
Mxq#%4
Bq` bB
o'f#j
:#LqG2
F?HI4w
Q{.UzT
l..ek\
IRXyXS
r0iQ3,p
KJ#U$W
[V<m_A
LR&2do
af^|-f
<-?\jq<
8 <1wE
JUMJ-.
W)f])Y
T5KzvL
zQ_G>B
RPASRj
:KVw/]
K~>iqg
{F1V'<hF
ISp-x
<%6RYt
|dB]cz
?DD(1V
MjDBf(
==_Tg?"
7.F3dOi
v:kTgZ
8$gh>K
,al*TM
-SlF_C
8)pPJ&
K},1v2K
x{;$]k
[1EI.
DwqrtH
:X8B"
kv-?vr
&afZ8r
OyMYhR
43?(B.
20{TLD
qP&]X_x
%k>&um
5nZj%n
,7h.)g
$6w{D;R
OTY"m\&
X,WO0n
6_}f1,]
!#}-12
&wU1qk
)\cMs+
=\m/hJ
VDcvQl
}k{ChR
.jwpGd
GAO?AHM
+!r)(
BkC^*G?v(jj^=]
YJaz:
~x|v^>
G^:bA
Wvt:>KZ
bK?c7"OV
e#),t?
M=QfLp
F)l=ox
xY[]36o
$VA{d*
Rtlj_W
Hf=~VR
nab/Sz
\`MG2'L:
*Ie'k-
P#]DY.p
s'Eo]6Q
UwL|VC
i0>=Qx
f=7kd(
7AZBj
H8D!O-q^
Q@=yjQD
>k='SL
VgC+-,
5+1XJ'
I_oNVG
Ig0nM
[K0O1A
[,qcnH
pJrLVz
s1*Kwa
4:P>sg
]vv[U&
=B2;8J
Y$Zqqq`
uH;8[%
Vg E~N
koFqg=t
'oX>=8
1O~./kN)
AJMK:_"
D?.3E/
>hr(#.cm
nq?xBA
wn*H=Vj#
Ea=11^L
]UakMi
;o",DO
@[Que/s
iglX!B
/pC00:
Y]'@-x
l8|qFKw
D|5V35h$
eDz{qMe
w,W+Edm
vL?f`{j>
3D,.S4
`b? gX>
8P|[l%.
"8= WXB<t
]Dof9U
*Ar![g;
@os3Og|
jb2xHk
:3yW-%
rfj/)!
WMmi%B
[:)=#J
JAeb4c0
N.IF"
v_i|A9
:{%Y8b
ZX[")I
cx*^*3
M)e2yT,g
>~l>{M3
*klC{W
Y6+Hwrq
9(GPghb
5)D)$x,9
RVDrJ
p50d4s
2i.2".q
)p~bYd
&i7[oWB
d39\:|
J<g8=s?S
tX4Yj^`
n},`a+
EIUX=dq
D+9~Au/
ZG;CCclh
Zz_j{[d
.t"pt6
Xb*U/?bq
8T66}6
#=f;>`
-MmCUx<$
{:] I-e\0z#1
e~Q2*j
I=1D `_3n
h|Rsjd
(hHpuCIA
C4a2E6X
ZQi6 :
7!^Tw"L-
Efv@+3
yOkk-um
|C1eR:qd
/L='DG
mkdpyYn[
l5):J~8
'>9lew
LdC+74
]JP!\
eW(hrIDs
%1Q($f8
MsiZbu
tGy%MF
=c]Y5l
0'.iG&
e.bc>4f
w}UMK
F`E1Ih
=+M-
u@7.A:k
Acpm2J
7iKJVNK
vlaa6a
r[`S'.j
6%IjaW
^X?_\;
y@C1r2=
Wz*D3)
l!rfelA{
zQuaQd
g"b:8p
^>}9,")
lc>Pcn
P1m]UF
GzPaR(3
u_<E#I
evev=J
C"w4DL
Z{4CYi~0
Ks!SYr;
&KH8@%
#/WgM
/'kO1^
<,qYUo
^x5tr1
cZwBmU
Ql^/r~L
!y.?ZN
LI!!7_O>
;>]ea/X1W
|zxWj0=42Y
"?%7kn
}'4e?z
`Ws/>>
RwDqBq
KId)DE
T;T52=
hzZW@84
lrz=_)
%:tk=1/R$
b?IM7j|
enmw8V
Gx&)^Ho
.+@]B
iJtu&.
#'>gb
{47=,J
]9r~AQ
8f7:d*
W5^zO1
ZdD#IV
:<s-&g
7aib +p
VYthzh1
?s9&g<-
83"9ZK
-3`% X
6ru9y7
+^He~
!>:H8N&0OY~l
P/#-CB
/V~~G\B
}sw!4z
+##@~k
A8@xaq
K@>#!^8
HIGbK5l
{mN,{&
+R>mSX"
$@Ouh?
Dz]@pK
S"z2ZYj
4!xi(&
9\2o=a
2416@v
*VIc&)
XN5@H
}+^(;+7)|
>4{o6\
ucC2<<R
6%*w<_
'${h1W
MQhA3f(X
[O>&5<
,+T@!V
"Wk92
3?L9QM26
h-@xfD
YI$+7v
[&L#_t
yGf#QF
oQ"Br:
Hm9z-U
)GK\e#
dqPZiFx
c%Tmu=
Z.>AXr
+hK4O):
;40n@ic
*;Ioot
VIUjO(e
Dgk95@
'>(V9V
b{/|Pc
+kEHM:\
'h/Qj@9
Hhr:+kG*q
qh.Y[
4@l$dr
ncp-eBy
P69]@Y
RIUfr`1?
wGn\<>
Cn7I^a
94m~q'
cE;GX{`
}E/2,7VS
rpmO2>rO
&K%OJBb
]SPptL
-R (E%
RZvUw*
'bECPY
T<p=HS
ECU,&{
_89NMI
<Cp= ,h
Tq#~8^+
xV<-;/
Je_"dN
'&d+de
!LwlGA
DfuAt0
v4.0.30319
#Strings
ETL_013265_601_0278
ETL_013265_601_0278.exe
mscorlib
System.Windows.Forms
System
System.Core
System.Xml.Linq
Utescvaxlaalw
Microsoft.CSharp
System.Drawing
Dqljkreuchrl.d.resources
Dqljkreuchrl.Properties.Resources.resources
Dqljkreuchrl.Utescvaxlaalw.dll
Binder
Microsoft.CSharp.RuntimeBinder
CSharpArgumentInfo
CSharpArgumentInfoFlags
CSharpBinderFlags
Action`1
Action`5
Activator
AppDomain
Boolean
GeneratedCodeAttribute
System.CodeDom.Compiler
EqualityComparer`1
System.Collections.Generic
IEnumerable`1
IEnumerator`1
List`1
IEnumerator
System.Collections
IContainer
System.ComponentModel
ApplicationSettingsBase
System.Configuration
SettingsBase
Console
DebuggerBrowsableAttribute
System.Diagnostics
DebuggerBrowsableState
DebuggerHiddenAttribute
DebuggerNonUserCodeAttribute
SystemColors
EventArgs
EventHandler
Func`2
Func`3
CultureInfo
System.Globalization
IDisposable
IFormatProvider
System.IO
Stream
IntPtr
Enumerable
System.Linq
ParallelEnumerable
ParallelQuery`1
Object
Assembly
System.Reflection
AssemblyCompanyAttribute
AssemblyConfigurationAttribute
AssemblyCopyrightAttribute
AssemblyDescriptionAttribute
AssemblyFileVersionAttribute
AssemblyProductAttribute
AssemblyTitleAttribute
AssemblyTrademarkAttribute
BindingFlags
ResolveEventArgs
ResolveEventHandler
ResourceManager
System.Resources
CallSite
System.Runtime.CompilerServices
CallSiteBinder
CallSite`1
CompilationRelaxationsAttribute
CompilerGeneratedAttribute
RuntimeCompatibilityAttribute
RuntimeHelpers
SuppressIldasmAttribute
ComVisibleAttribute
System.Runtime.InteropServices
GuidAttribute
TargetFrameworkAttribute
System.Runtime.Versioning
RuntimeFieldHandle
RuntimeTypeHandle
STAThreadAttribute
Single
String
Encoding
System.Text
Thread
System.Threading
ThreadStart
ValueType
Application
AutoScaleMode
Button
ButtonBase
ContainerControl
Control
ControlCollection
XDocument
ClassLibrary
<Module>
Settings
Dqljkreuchrl.Properties
Dqljkreuchrl
.cctor
Equals
GetHashCode
ToString
Dispose
k8rb8lrdpvfwvaja3psg2lda5effygsu4Qpqa
k8rb8lrdpvfwvaja3psg2lda5effygsu4Qpqb
Synchronized
get_Default
Format
get_UTF8
GetBytes
Select
ReadAllBytes
get_CurrentDomain
add_AssemblyResolve
PerformClick
SelectMany
ToList
ForEach
InitializeArray
AsParallel
AsEnumerable
GetEnumerator
get_Current
GetTypeFromHandle
CreateInstance
Create
InvokeMember
Target
Invoke
MoveNext
GetExecutingAssembly
GetManifestResourceStream
get_Length
Concat
WriteLine
set_Location
set_Name
set_Size
set_TabIndex
set_Text
set_UseVisualStyleBackColor
add_Click
set_AutoScaleMode
get_GrayText
set_BackColor
set_ClientSize
get_Controls
add_Load
ResumeLayout
SuspendLayout
set_AutoScaleDimensions
Repeat
AddRange
IndexOf
EnableVisualStyles
SetCompatibleTextRenderingDefault
get_Assembly
GetString
KMicrosoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator
11.0.0.0
3System.Resources.Tools.StronglyTypedResourceBuilder
16.0.0.0
WrapNonExceptionThrows
Firefox
Mozilla
$552ca2ec-e37d-4b02-b25d-96a3c273921b
18.5.0.0
.NETFramework,Version=v4.0
FrameworkDisplayName
.NET Framework 4
_CorExeMain
mscoree.dll
<?xml version="1.0" encoding="utf-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><assemblyIdentity version="1.0.0.0" name="MyApplication.app" /><trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"><security><requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"><requestedExecutionLevel level="asInvoker" uiAccess="false" /></requestedPrivileges></security></trustInfo></assembly>PADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADD
GitHub
lbcdefghijklm
{{ bucket = {0}, i = {1} }}
{{ Value = {0}, Index = {1} }}
Dnvjibosmp
Multiple each item in a list by 2
Sum a list of numbers
and stuff
This is an example tweet talking about C# and stuff
Verify if a word exists in string
Show matched words in string
Read in a File
oneliners.exe
Happy Birthday
Filter list of numbers >60
Filter list of numbers <=60
Fetch and Parse an XML web service
http://search.twitter.com/search.atom?&q=scala
Find minimum in a list
Find maximum in a list
Parallel Processing
Sieve of Eratosthenes
Fizzbuzz
WriteLine
{0}: {1}
Dqljkreuchrl.Utescvaxlaalw.dll
button1
Happy Birthday {0}
to You
dear NAME
Dqljkreuchrl.Properties.Resources
GitHub
VS_VERSION_INFO
VarFileInfo
Translation
StringFileInfo
000004b0
Comments
Firefox
CompanyName
Mozilla
FileDescription
Firefox
FileVersion
18.5.0.0
InternalName
ETL_013265_601_0278.exe
LegalCopyright
Mozilla
LegalTrademarks
OriginalFilename
ETL_013265_601_0278.exe
ProductName
Firefox
ProductVersion
18.5.0.0
Assembly Version
18.5.0.0