Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Building an int[] from individual setting values
Message
 
To
29/07/2008 18:26:18
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01335105
Message ID:
01335151
Views:
16
>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());
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform