Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building an int[] from individual setting values
Message
 
À
29/07/2008 18:26:18
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01335105
Message ID:
01335151
Vues:
15
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform