Hi,
How we can select the value of one property on the basis of another property value Enumeration. Following is my Senario:
C#
public BaseTypeValue MyBaseTypeValue { get; set; }
public NumberValue MyNumberValue { get; set; }
public ValueType MyValueType { get; set; }
Public Enum BaseTypeValue
{
ABC,
DEF
}
Public Enum NumberValue
{
123,
456
}
Public Enum ValueType
{
7.5,
2.5
}I have three properties MyBaseTypeValuee, MyNumberValue, and MyValueType of types Enumerations respectively. Now I want if someone selects the value of MyBaseTypeValue property then the next two property values are automatically selected on the bases of MyBaseTypeValue. Following is the condition:
C#
If(MyBaseTypeValue == BaseTypeValue.ABC )
{
MyNumberValue = NumberValue.123;
MyValueType = ValueType.7.5;
}
else
{
MyNumberValue = NumberValue.456;
MyValueType = ValueType.2.5;
}How we can implement this logic in the Model (C# Model Class)?


Sachin SinghRank #66 · 26.2K reputationPosted Sep 2, 2021, 6:08 AM EDT
Adalat KhanRank #1,143 · 1.6K reputationPosted Sep 3, 2021, 3:33 AM EDT