How can I use Enums on my Razor page in MVC3?

前端 未结 3 764
一整个雨季
一整个雨季 2021-02-18 20:17

I declared an enum:

public enum HeightTypes{    Tall,    Short}

Now I want to use it on my razor page like this:

@if (Model.Met         


        
3条回答
  •  有刺的猬
    2021-02-18 21:08

    Just do give a start-to-finish example:

    C# CS Page

    namespace MyProject.Enums
    {
        public enum CurveBasis
        {
            Aggregates,
            Premium
        }
    }
    

    Razor View

    @using MyProject.Enums
    
    
    

提交回复
热议问题