Skip to content

Instantly share code, notes, and snippets.

View bartdesmet's full-sized avatar

Bart J.F. De Smet bartdesmet

  • Microsoft
  • Redmond, WA
View GitHub Profile
@bartdesmet
bartdesmet / CSharpLanguageInternals.cs
Created May 7, 2024 14:42
C# Language Internals @ Techorama 2024
using System.Collections.Immutable;
using System.Numerics;
using System.Runtime.CompilerServices;
internal class Program
{
static void Main(string[] args) => Console.WriteLine("C# Language Internals @ Techorama 2024");
}
class CSharp7
```csharp
/* _ __ ___ _ ____ ____ _ __ __ __ _ _ ___ _ _ __ __
(_)/ _| / / | __ _ _ __ __ _ (_)___ / ___/ ___|| |__ __ _ _ __ _ __ / / \ \ / /__ _ __ ___(_) ___ _ __ _ / |/ _ \ ___ _ __ / / | \ \\ \
| | |_ | || |/ _` | '_ \ / _` | | / __| | | \___ \| '_ \ / _` | '__| '_ \ | | \ \ / / _ \ '__/ __| |/ _ \| '_ \(_) | | | | | / _ \| '__| | | | | || |
| | _| | || | (_| | | | | (_| | | \__ \ | |___ ___) | | | | (_| | | | |_) | < < \ V / __/ | \__ \ | (_) | | | |_ | | |_| | | (_) | | | | | > > |
|_|_| | ||_|\__,_|_| |_|\__, | |_|___/ \____|____/|_| |_|\__,_|_| | .__/ | | \_/ \___|_| |___/_|\___/|_| |_(_) |_|\___/ \___/|_| |_|_| | || |
\_\ |___/ |_| \_\ /_//_/
____ _
@bartdesmet
bartdesmet / InExpression.MD
Last active October 19, 2022 14:12
Roslyn workshop (Techorama) - Add a new `in` expression to C#

Add a new in expression to C#

Goals

In this workshop, we'll add a new in expression to C#, with example use cases shown below:

x in 1..10     // x >= 1 && x < 10
'a' in "bar"   // "bar".IndexOf('a') >= 0   -or-   "bar".Contains('a')
x in xs // xs.Contains(x)