HowToForums.net Forum Index HowToForums.net
An Open Source of Knowledge
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

אני צר&

 
Post new topic   Reply to topic    HowToForums.net Forum Index -> OpenU Technical Discussion
View previous topic :: View next topic  
Author Message
ylyael



Joined: 29 Jul 2009
Posts: 1

PostPosted: Fri Aug 07, 2009 9:04 am    Post subject: אני צר& Reply with quote

יש למישהו את התוכנית שעברנו עליה בכיתה עם ה CarEnumarable וה PrkingLot: IEnumarable ?

וכן את המצגת של Interface ?

אם כן, בבקשה צרפו לכאן או דרך המייל

תודה
Back to top
sharonshmuelfeldman



Joined: 29 Jul 2009
Posts: 8

PostPosted: Fri Aug 07, 2009 6:57 pm    Post subject: i don't have it but there is good sample in msdn and samples Reply with quote

//1) define class as ienumerable.

public class Token : IEnumerable
{
private string[] elements;
....

//2) in Token class Write/copy The GetEnumerator methode

public IEnumerator GetEnumerator()
{
return new TokenEnumerator(this);
}

//3) write/copy the IEnumerator class :
private class TokenEnumerator : IEnumerator
{
private int position = -1;
private Tokens t;

public TokenEnumerator(Tokens t)
{
this.t = t;
}

// Declare the MoveNext method required by IEnumerator:
public bool MoveNext()
{
if (position < t.elements.Length - 1)
{
position++;
return true;
}
else
{
return false;
}
}

// Declare the Reset method required by IEnumerator:
public void Reset()
{
position = -1;
}

// Declare the Current property required by IEnumerator:
public object Current
{
get
{
return t.elements[position];
}
}
}



________
Vermont Medical Marijuana
Back to top
Display posts from previous:   
Post new topic   Reply to topic    HowToForums.net Forum Index -> OpenU Technical Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group