locked
How to create a property (get, set) for enum int ? RRS feed

  • Question

  • User632428103 posted

    Hello all,

    i have an enum as this :

    public enum Animal
    {
       Dog = 0,
       Cat,
    }

    now, i would like to store into database the value (int) of this enum

    how i can create a property for to do that ?

    Public int AnimalType
    {
    get; set; ?
    }

    this property will be save the int value into sql 

    Thursday, June 7, 2018 2:57 PM

Answers

  • User-369506445 posted

    Hi

    You can define below like

    Public Animal AnimalType {get; set; }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 7, 2018 3:04 PM

All replies

  • User-369506445 posted

    Hi

    You can define below like

    Public Animal AnimalType {get; set; }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 7, 2018 3:04 PM
  • User632428103 posted

    Rhooo sorry i think in my head that's was clear !

    Ok i've test that work fine ...

    Thursday, June 7, 2018 3:22 PM