简体   繁体   中英

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.

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.

第一个“ Enum”必须是一个小的关键字“ enum”,它假定此声明为属性声明而不是enum。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM