Say Something About ienumertor [Resolved]

Posted by Sabarimahesh under C# on 3/22/2012 | Points: 10 | Views : 1158 | Status : [Member] | Replies : 9
This Question Asked in the interview

Kindly Say ur Valuable answers

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M



Responses

Posted by: Patel28rajendra on: 3/22/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi

see this link

http://www.codeproject.com/Articles/4074/Using-IEnumerator-and-IEnumerable-in-the-NET-Frame

R D Patel

Sabarimahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 3/23/2012 [Member] Bronze | Points: 50

Up
0
Down

Resolved
Hi ramesh,

Normaly Enumerator works with Collection type of object, I will explain you with small example:

List<Employee> list = new List<Employee>(){
new Employee() { FirstName="Himanshu", LastName="Manjarawala", Age=30},
new Employee(){ FirstName="Hetal", LastName="Sangani", Age=26},
new Employee(){ FirstName="Viral", LastName="Sangani", Age=32},
new Employee(){ FirstName="Rajesh", LastName="Patel", Age=29},
new Employee(){ FirstName="Nehal", LastName="Thakkar", Age=30}
};

IEnumerator<Employee> objEnumerator = null;
while ((objEnumerator = list.GetEnumerator()) != null)
{
Employee e = objEnumerator.Current;
//your operation with Employee object
}


Mark this as answer, if it helps you................

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Sabarimahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 3/22/2012 [Member] Starter | Points: 25

Up
0
Down
Hi
refer this also

http://stackoverflow.com/questions/456433/when-should-i-use-ienumerator-for-looping-in-c

R D Patel

Sabarimahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 3/23/2012 [Member] Bronze | Points: 25

Up
0
Down
Patel28rajendra

hAVE YOU USED THIS BEFORE

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Sabarimahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 3/23/2012 [Member] Silver | Points: 25

Up
0
Down
It is the base interface for all nongeneric enumerators.
For more info:
http://msdn.microsoft.com/en-us/library/system.collections.ienumerator.aspx

Thanks,
Sanjay

Sabarimahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 3/23/2012 [Member] Bronze | Points: 25

Up
0
Down
Sksamantaray
THANKS MAN
I VISITE THIS LINK BEFORE

I EXPECTED LIKE Hmanjarawala REPLY..

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Sabarimahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 3/23/2012 [Member] Bronze | Points: 25

Up
0
Down
Hmanjarawala

THANKS MAN

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Sabarimahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 3/23/2012 [Member] Silver | Points: 25

Up
0
Down
Yeah Himanshu has given a nice example,
Thanks Himanshu.

Thanks,
Sanjay

Sabarimahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 3/23/2012 [Member] Starter | Points: 25

Up
0
Down
why you don't Mark as Answer even if you got the Answer

R D Patel

Sabarimahesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response