Skip to content

Instantly share code, notes, and snippets.

@ufcpp
Last active July 16, 2022 06:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ufcpp/93caaa4f7652846b1f68fe687ef2d5d5 to your computer and use it in GitHub Desktop.
Save ufcpp/93caaa4f7652846b1f68fe687ef2d5d5 to your computer and use it in GitHub Desktop.
#nullable disable
#pragma warning disable IDE0004, IDE0049, IDE0052, IDE0055, IDE0060, CS1998, CS0626
using static System.Runtime.CompilerServices.Unsafe;
class A
{
Func<Task<object>> _x;
public object X
{
set => _x = async () =>
from x in value
join y
// 62 keywords (44 distinct)
in await value is not bool or char or byte or sbyte or short
or ushort or int or uint or nint or nuint or long or ulong or
float or double or decimal or string and var _ as dynamic as
object on false equals null where this orderby default ascending
orderby null descending group null by static ref readonly global
// todo in C# 11: where field
::System.Int32() => ref NullRef<int>()
into _
where new object()
where true with { }
select static async void () => { };
}
public object Y
{
set => _x = async () =>
from x in value
join y
// 27 distinct keywords
in await value is not bool or byte and var _ as object on false equals
null where this orderby default ascending group true by static ref readonly int
() => ref NullRef<int>();
}
public static void M(object x)
{
switch (x)
{
// 14 distinct keywords
case not null and bool or byte when true as object is var _
: break;
}
}
// 7
unsafe protected private readonly ref partial struct
S { }
// todo in future?: ref record struct
// 8
unsafe protected internal extern static ref readonly int
M();
unsafe protected internal virtual ref readonly int M2() => ref NullRef<int>();
}
partial class B : A
{
// 9
unsafe protected internal sealed override partial ref readonly int
M2();
}
partial class B
{
unsafe protected internal sealed override partial ref readonly int M2() => ref NullRef<int>();
}
static partial class Ex
{
public static object Select(this object x, Func<object, object> f) => null;
public static object Join(this object x, object y, Func<object, object> a, Func<object, object> b, Func<object, object, object> c) => null;
public static object Where(this object x, Func<object, object> f) => true;
public static object OrderBy(this object x, Func<string, object> f) => null;
public static object OrderByDescending(this object x, Func<object, object> f) => null;
public static object GroupBy(this object x, Func<object, object> a, Func<string, object> b) => null;
}
using System.Runtime.CompilerServices;
static partial class Ex
{
public static ValueTaskAwaiter<object> GetAwaiter(this object x) => default;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment