This is a repo containing a collection of personal snippets of "cursed" C# code, i.e. code that is intentionally confusing, obscure, counter-intuitive, comically impractical, and/or otherwise bizarre.
The main purpose of this code is to demonstrate quirks of C# syntax and semantics.
| File | Output | Description |
|---|---|---|
| ListPattern.csx | true |
Uses a list pattern to match an array of structs. |
| Var.cs | Compiles | Uses three different naming scopes with the identifier var. |
| Delegate.csx | Throws NullReferenceException |
Confusingly named delegate invoked with a null instance of itself as an argument. |
| StackOverflow.csx | Stack overflow | Abuses a recursive property in script mode. |
| Attribute.cs | Compiles | Abuses an invalid attribute target so the compiler ignores the entire attribute. |