Skip to content

Unable to add Action.Arguments to task defenition #911

Answered by dahall
ArtHansen asked this question in Q&A

You must be logged in to vote

Here's a little snippet to demonstrate a little more elegant solution:

public class Element<T>
{
    public Element(T value, string text) { Value = value; Text = text; }
    public T Value { get; set; }
    public string Text { get; set; }
    public bool Selected { get; set; }
    public override string ToString() { return Text ?? ""; }
}

public static void Main()
{
    // Build a list of elements with the enum values and their localized text values
    List<Element<MonthsOfTheYear>> months = Enum.GetValues(typeof(MonthsOfTheYear)).Cast<MonthsOfTheYear>().Take(12).Select(v => new Element<MonthsOfTheYear>(v, TaskEnumGlobalizer.GetString(v))).ToList();
    
    // TODO: Use 'months' to po…

Replies: 4 comments 3 replies

You must be logged in to vote
1 reply
@ArtHansen

You must be logged in to vote
0 replies

You must be logged in to vote
1 reply
@ArtHansen

Answer selected by dahall

You must be logged in to vote
1 reply
@ArtHansen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants