Skip to content
Discussion options

You must be logged in to vote

If I write the lambda like:

  var lambda = ref int () =>
  {
      ref int scopedXref =ref System.Runtime.CompilerServices.Unsafe.AsRef(x);
      return ref scopedXref;
  };

I can make the captured local scoped. But because it is actually a field which lives on the heap, shouldn't it be implicitly scoped?

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@333fred
Comment options

@bernd5
Comment options

@bernd5
Comment options

@333fred
Comment options

Answer selected by bernd5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants