How to distinguish between indexing an array and a dynamic object

Topics: APIs
Aug 25, 2014 at 7:16 PM
An indexing, such as obj[a, b] is represented by an ElementAccessExpressionSyntax. To distinguish between an indexer access and an array access it is possible to use SemanticModel.GetSymbolInfo().Symbol and check if that returns an IPropertySymbol.

However, if the type of obj is dynamic, GetSymbolInfo().Symbol will be null just as in the array case, leaving no way (at least that I have found) to differentiate the two cases of obj being an int[,] and a dynamic.