Skip to content

Error with in this and ref this as Parameters in Static Method Calls #8059

Closed Answered by huoyaoyuan
aa89227 asked this question in Q&A
Discussion options

You must be logged in to vote

This is intentional and the whole purpose of ref readonly feature. in x must be used with a location (field or local variable). When passing value x, the compiler will implicitly assign a location y = x and pass in y. ref readonly disallows such implicit variable.

this is a value, not stored a particular location. The same applies to string literals etc. You can't say in "abc" either.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@aa89227
Comment options

Comment options

You must be logged in to vote
1 reply
@aa89227
Comment options

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