public static string GetCountOrLengthPropertyName( ExpressionSyntax expression, SemanticModel semanticModel, CancellationToken cancellationToken = default(CancellationToken)) { ITypeSymbol typeSymbol = semanticModel.GetTypeSymbol(expression, cancellationToken); if (typeSymbol?.IsErrorType() == false && !typeSymbol.IsConstructedFromIEnumerableOfT()) { if (typeSymbol.IsArrayType() || typeSymbol.IsString() || typeSymbol.IsConstructedFromImmutableArrayOfT(semanticModel)) { return("Length"); } if (SymbolUtility.ImplementsICollectionOfT(typeSymbol)) { return("Count"); } } return(null); }