Skip to content

Instantly share code, notes, and snippets.

public static void SwitchPattern(object o)
{
switch (o)
{
case null:
Console.WriteLine("it's a constant pattern");
break;
case int i:
Console.WriteLine("it's an int");
break;
/// <summary>
/// Gets or the current customer if they are registered, if not registered it returns null
/// </summary>
[CanBeNull]
public virtual Customer CurrentRegisteredCustomer
{
get
{
//whether there is a cached value
if (_cachedCustomer != null)