Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Building an int[] from individual setting values
Message
From
30/07/2008 07:48:50
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01335105
Message ID:
01335205
Views:
13
>>Ok, I am just having a mental block. I need an int[] made up of values from individual setting values like these:
>>
>>
>>
>>public bool ActivateAntenna1 = true;
>>public bool ActivateAntenna2 = false;
>>public bool ActivateAntenna3 = true;
>>public bool ActivateAntenna4 = false;
>>
>>I need an int[] that looks like this in this case:
>>this.reader.Attributes.SetANTS(new int[]  { 1, 3 } );
>>
>
>I would probably do something like:
>
><pre>
>List<int> list = new List<int>();
>if (ActivateAntenna1)
>   list.Add(1);
>if (ActivateAntenna2)
>   list.Add(2);
>
>this.reader.Attributes.SetANTS(list.ToArray());
>
Thanks Paul,
I will try that out. I noticed the samples the third party product show has a trailing comma like below. It doesn't seem normal, any idea why they would have this?
this.reader.Attributes.SetANTS(new int[] { 1, 3, } );  Notice the trailing comma after the three.
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform