Variation Generation Parameter Attributes

Sep 21, 2012 at 2:01 PM

Hello All, 

       I am attempting to use the API at my work and have come across the following error when trying to build the following snippet.

class MyJobsWindow
        [Parameter(0, 1, 12, 24)]
        public int window_start_hours { get; set; }
        [Parameter(new int[]{1,2,3,4})]
        public int window_start_minutes { get; set; }

        [Parameter(new string[]{ "p1", "p2", "p3" })]
        public string window_start_date { get; set; } 


Error 1 An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type c:\users\suresh.nanjan\documents\visual studio 2010\Projects\SprtJobsVariations\SprtJobsVariations\SprtJobsModel.cs 81 20 SprtJobsVariations

I am surprised that I get this error only when I try to use some string type values for my ParameterAttribute ctor. Am I missing some thing fundamental here, I appreciate any help.

My intention is to use the following form of supplying values to parameter fields

[Parameter(new string[]{ 
DateTime.Today.AddDays(-1).ToString(), DateTime.Today.ToString(), DateTime.Today.AddDays(1).ToString(), DateTime.Today.AddDays(-7).ToString(), DateTime.Today.AddDays(7).ToString(), DateTime.Today.AddMonths(-1).ToString(), DateTime.Today.AddMonths(1).ToString() }