Unfortunately the IEnumerator interface that is used for the foreach only
provides the methods Current, MoveNext and Reset. Without knowing what the
options object is I can only assume it implements the following:
int poll = kk[ options.IndexOf(option) ].PollId;
This actually iterates through the list testing the equality using
object.Equals(object2) in which case it may be just as quick to use a for
loop:
<ObjectItem> option;
for(int i = 0; i < options.Count; i++)
{
option = options.Item[i];
if(option.Text.Length >0)
{
int poll = kk[i].PollId;
}
}
Setting the option var is optional in this case just depends on how much you
want to access the object and if your happy typecasting.
- Mike
---------------------------------------------------------------------------------
<a href="http://www.cogitar.net"> Cogitar Software. (
www.cogitar.net) </a>
http://www.web-dominion.co.uk Web-Dominion. (Web Design and hosting )
---------------------------------------------------------------------------------
"mike" <so**********@gmail.com> wrote in message
news:eZ**************@tk2msftngp13.phx.gbl...
what should i have to write in this code section?
#### is what i want to write
do i have to use foreach to for
if options is TextBox array
i used to enumbera....... but i don't remember...what is this??
foreach (TextBox option in options)
{
if (option.Text.Length > 0)
{
int poll = kkk[ ##### ].PollId;
}
}