How to extend default enum class of nopCommerce

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
I have developed one custom plugin, in which i want to extend enum class (ProductSortingEnum) of default nopCommerce.

I'm doing like following, but it's not a solution

public enum MyCustomSortingEnum : ProductSortingEnum
{
        RatingAsc = 18,

        RatingDesc = 19,

        Popular = 20,  

}

  
Is it possible to extend enum class ? if yes then please advice me, How can i do that ?

Thanks.
7 years ago
So far I know you can not extend enum. May be http://stackoverflow.com/questions/757684/enum-inheritance can help you.
7 years ago
sina.islam wrote:
So far I know you can not extend enum. May be http://stackoverflow.com/questions/757684/enum-inheritance can help you.


Hi,

Is there any other way to do that ?
7 years ago
divyang16 wrote:
So far I know you can not extend enum. May be http://stackoverflow.com/questions/757684/enum-inheritance can help you.

Hi,

Is there any other way to do that ?


Sorry divyang16 I do not know other way. I did change to the default enum and change the Stored Procedure "ProductLoadAllPaged" accordingly.
7 years ago
As far as I know, ENUM is not inheritable. That is C#'s limitation, not nopCommerce's. :)
7 years ago
wooncherk wrote:
As far as I know, ENUM is not inheritable. That is C#'s limitation, not nopCommerce's. :)


Hi wooncherk,

Yes, That's true. But i want to know if there any alternate solution !
7 years ago
Not that I know of, except changing the code. :)
7 years ago
As far as I know you cannot extend enum being a part of c#.net. You can create your own enum and use that if that fits in your scenario.
5 years ago
That means, if I need any extra enum value, I must change in the core code. :(
5 years ago
Yes Ratul, you’ve to change in code
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.