There are lots of cases that you can improve. The examples use nullable reference types, but only the WhenNotNull
example requires it.
Consider adopting the new property pattern, wherever you use IsNullOrEmpty
.
string? hello = "hello world";
<PropertyGroup> | |
<PathMap>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))=./</PathMap> | |
</PropertyGroup> |
function Get-UserInput { | |
<# | |
.SYNOPSIS | |
Asks for user input, then validates response. | |
.DESCRIPTION | |
Asks for user input, then validates response. | |
.PARAMETER Prompt | |
The message to show to the user as input prompt. |
using System; | |
using System.Threading.Tasks; | |
namespace System.Collections.Concurrent | |
{ | |
public static class ConcurrentDictionaryExtensions | |
{ | |
/// <summary> | |
/// Provides an alternative to <see cref="ConcurrentDictionary{TKey, TValue}.GetOrAdd(TKey, Func{TKey, TValue})"/> that disposes values that implement <see cref="IDisposable"/>. | |
/// </summary> |
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Reflection; | |
using System.Runtime.Loader; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc.ApplicationParts; | |
using Microsoft.AspNetCore.Mvc.Infrastructure; |
There are lots of cases that you can improve. The examples use nullable reference types, but only the WhenNotNull
example requires it.
Consider adopting the new property pattern, wherever you use IsNullOrEmpty
.
string? hello = "hello world";