foreach(string value in Enum.GetNames(typeof (MyEnum)))
{
if (aA == MyEnum.value)
bB = value.ToString();
}
from code similar to this
public enum MyEnum
{
X,
Y,
Z
}
//This namespace holds Strategies in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Strategies
{
public class MyXConverterStrat : Strategy
{
private string bB;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
...
foreach(string value in Enum.GetNames(typeof (MyEnum)))
{
if (aA == MyEnum.value)
bB = value.ToString();
}
aA = MyEnum.X;
Button1Label = bB;
...
}
}
...
#region Properties
[Display(Name="Button Methods", Description="", Order=1, GroupName="Button Parameters")]
[RefreshProperties(RefreshProperties.All)]
public MyEnum aA
{ get; set; }
[NinjaScriptProperty]
[Display(Name="Label Button 1", Order=2, GroupName="Buttons Parameters")]
public string Button1Label
{ get; set; }
#endregion
}
}
((Months)int.Parse(monthNum)).ToString()
How to adapt it to string?

Comment