Exemple #1
0
        private string AdjustIfEventIdentifier(string valueText, CS.CSharpSyntaxNode parent)
        {
            var  symbol  = GetSymbol(parent) as IEventSymbol;
            bool isEvent = symbol.IsKind(SymbolKind.Event);

            if (!isEvent)
            {
                return(valueText);
            }

            var operation = _semanticModel.GetAncestorOperationOrNull <IEventReferenceOperation>(parent);

            if (operation == null || !operation.Event.Equals(symbol) || operation.Parent is IEventAssignmentOperation ||
                operation.Parent is IRaiseEventOperation || operation.Parent is IInvocationOperation ||
                operation.Parent is IConditionalAccessOperation cao && cao.WhenNotNull is IInvocationOperation)
            {
                return(valueText);
            }