Why does the with-operator need parenthesis around the expression to access object. #5378
Unanswered
FreeApophis
asked this question in
Q&A
Replies: 2 comments 9 replies
-
I'm going to suggest that it's possible to ask this question about being required to wrap the "with" expression in parenthesis without being combative. |
Beta Was this translation helpful? Give feedback.
4 replies
-
This discussion about choosing the precedence of the Since the |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We found very strange behaviour on the
with
-operator. I'd like to discuss if this is an oversight or if there are some real implications.When you create an instance of Type T with the Property Initializer, the expression itself is of type T.
However if you create an instance of Type T using a with-expression Initializer, I cannot access the Interface of the Type T.
Here is a full example:
When analyzing the syntax-tree with Rosly-Quoter, it looks like the Syntax-Tree is very similar, and I think it should be handled similarly.
Could you please point me to the C# language specification which describes this behaviour, I have read the 5 paragraphs about the with-expression, I did not find an explanation.
Beta Was this translation helpful? Give feedback.
All reactions