Exemplo n.º 1
0
        public static Span IsVirtualProperty(this PropertyDeclarationSyntax node)
        {
            if (node == null)
            {
                return(null);
            }

            var type = node.GetDeclaringType();

            if (type is InterfaceDeclarationSyntax)
            {
                return(null); //Don't run the check on an interface property
            }
            if (node.Modifiers.ContainsToken("override") || node.Modifiers.ContainsToken("abstract"))
            {
                return(null); //Overriden or abstract properties cannot be virtual
            }
            return(node.Modifiers.ContainsToken("virtual") ? null : node.Modifiers.Span.ToSpan());
        }