Is it possible to map between 2 different enums?
That is, I want to take one enum value and map it to a corresponding value in a different enum type.
I know how to do this with AutoMapper:
// Here's how to configure...
Mapper.CreateMap<EnumSourceType, EnumTargetType>();
// ...and here's how to map
Mapper.Map<EnumTargetType>(enumSourceValue)
But I'm new to ValueInjecter and can't figure it out.
** UPDATE **
The source and target enum types look something like:
public enum EnumSourceType
{
Val1 = 0,
Val2 = 1,
Val3 = 2,
Val4 = 4,
}
public enum EnumTargetType
{
Val1,
Val2,
Val3,
Val4,
}
So, the constants have the same names, but different values.
int
as the underlying type. The string names are the same in both enum types, but the integer values are different. – Cocowalla