PositiveGuy
PositiveGuy

Reputation: 47773

Accessor must declare a body because 'property' is not marked as abstract or extern

I've got this enum at the top of my instance class:

    public Enum RecommendationPage
    {
        Search,
        Cart
    }

I'm using it in static methods or at least attempting to. I get the error "Accessor must declare a body because 'property' is not marked as abstract or extern". This code is in a handler .ashx.

Upvotes: 1

Views: 980

Answers (2)

Akash Kava
Akash Kava

Reputation: 39956

First "Enum" has to be a small keyword "enum", it is assuming this declaration as property declaration instead of enum.

Upvotes: 3

Mark Rushakoff
Mark Rushakoff

Reputation: 258408

Make enum lowercase. You're telling the compiler that this is a property returning a System.Enum, but you haven't specified the get or set part of the property.

Upvotes: 6

Related Questions