Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

7 votes
3 answers
994 views

What is the difference between "this ref" and "ref this" when talking about C# 7.2 ref extension methods?

Consider the following extension methods: public static void Toggle(this ref bool @bool) => @bool = !@bool; public static void Toggle2(ref this bool @bool) => @bool = !@bool; These simply ...
taquion's user avatar
  • 2,727
4 votes
1 answer
583 views

C#. Ref returning delegate for ref extension method

I have the following extension method for monitoring a variable and awaiting until it has a given expected value: public static async Task AwaitForValue<T>(this Func<T> ...
taquion's user avatar
  • 2,727