Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to tell when accessing property #1807

lambertlb opened this issue Nov 21, 2019 · 2 comments


Copy link

@lambertlb lambertlb commented Nov 21, 2019

How can i tell when VisitMemberReferenceExpression is accessing a property as Follows?

public void VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression)

The memberReferenceExpression is "{dateTime1dArray.Length}"

The reference expression is accessing the Length property on an array. I have tried getting the Symbol and the IType on various parts of the expression like the Target and the Parent but can't seem to find anything to identify the MemberNameToken as a property. Can you please tell me how to figure out if the MemberNameToken is a Property?


This comment has been minimized.

Copy link

@dgrunwald dgrunwald commented Dec 1, 2019

In IL, getting the length of an array has its own opcode: ldlen
So there's no metadata token referring to a field or property.


This comment has been minimized.

Copy link

@siegfriedpammer siegfriedpammer commented Dec 1, 2019

I have added a MemberResolveResult referring to System.Array.Length / System.Array.LongLength, if the System.Array type is available. memberReferenceExpression.GetSymbol() should now return the correct info.

Thank you for reporting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.