On Oct 4, 4:27*am, shapper <mdmo...@gmail.comwrote:
Hi,
I have the following IEnumerable:
IEnumerable targets;
I want to add items to it where each item is as follows:
new { Name = "Book", Author = "John" }
I am just having a few problems in adding the items.
How is it done?
Thanks,
Miguel
Following is with ADD
class DataStruct
{
public string Name { get; set; }
public string Author { get; set; }
}
class MyEnumeratorClass : IEnumerable, IEnumerator
{
IEnumerator iEnum;
List<DataStructmyData = new List<DataStruct>();
public MyEnumeratorClass()
{
iEnum= myData.GetEnumerator();
}
public IEnumerator GetEnumerator()
{
return myData.GetEnumerator();
}
public void Reset()
{
iEnum.Reset();
}
public bool MoveNext()
{
return iEnum.MoveNext();
}
public object Current
{
get
{
return iEnum.Current;
}
}
public void ADD(DataStruct ds)
{
myData.Add(ds);
}
}
I hope this is what you are trying to achieve...
-Cnu