0

Inside mvc4 I have model

public class MyViewModel
{
    public SomeEnum MyEnum { get; set; }
    public string Name { get; set; }
}

this SomeEnum is located in other dll which is referenced from my web app. I cannot change this dll (SomeEnum) but for further clarity I want to use this enum (SomeEnum) but with little extension, I want to add few more enum properties.

How this can be done?

user1765862
  • 13,635
  • 28
  • 115
  • 220

1 Answers1

3

It cannot, basically.

All you can do is declare a new enum, perhaps with the same name in a difference namespace, perhaps with a different name:

namespace My.Local {
    public enum SomeEnum {
        // the originals
        A = The.Other.SomeEnum.A,
        B = The.Other.SomeEnum.B,
        C = The.Other.SomeEnum.C,
        // the extras
        D, E, F
    }
}
Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900