Skip to content

Instantly share code, notes, and snippets.

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591;CA1724;CS1574</NoWarn>
<OutDir>$(MSBuildProjectDirectory)\bin\</OutDir>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591;CA1724;CS1574</NoWarn>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Dependencies;
using Microsoft.Extensions.DependencyInjection;
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.3" />
</ItemGroup>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Dependencies;
using System.Web.Http.ExceptionHandling;
function BaselineFunctionWithoutSwitch($Value) {
$a = 0
}
function ffff($Value) {
switch($Value) {
{0..24 -contains $_} { $a = 0 }
{25..49 -contains $_} { $a = 1 }
{50..74 -contains $_} { $a = 2 }
{75..99 -contains $_} { $a = 3 }
}
}
function Get-RandomConjunction {
[CmdletBinding()]
param()
$Chance = Get-RandomPercent
switch ($Chance) {
{ 1..45 -contains $_ } { 'and' } # 45% chance for 'and'
{ 46..75 -contains $_ } { 'or' } # 25% chance for 'or'
{ 76..85 -contains $_ } { ',' } # 10% chance for 'comma'
{ 86..95 -contains $_ } { ';' } # 10% chance for 'semi-colon'
{ 96..100 -contains $_ } { ':' } # 5% chance for 'colon'
function RangeOperatorInFunc($Value) {
switch($Value) {
{0..24 -contains $_} { $a = 0 }
{25..49 -contains $_} { $a = 1 }
{50..74 -contains $_} { $a = 2 }
{75..99 -contains $_} { $a = 3 }
}
}
$gr1 = 0..24;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;