Returns the design mode (C #) series Article index
Introduced
Provides a way to access each element of an aggregate object sequentially without exposing the internal representation of that object.
Example
There is a message entity class, and each element within an aggregate object is the entity object, and now provides a way to access each element in the aggregate object sequentially.
Messagemodel
using System;
using System.Collections.Generic;
using System.Text;
Namespace Pattern.iterator
{
/**////<summary>
///message entity class
///</summary>
public class Messagemodel
{
/**////<summary>
///constructor
///</summary>
// /<param name= "msg" >message content </param>
///<param name= "PT" >message release time </param>
Pub Lic Messagemodel (String msg, DateTime PT)
{
This._message = msg;
This._publishtime = pt;
}
private string _message;
/**////<summary>
///message content
///</summary>
public string text
{
get {return _message;}
Set {_message = value;}
}
Private DateTime _publishtime;
/**////<SUMMARY>
///message publish time
///</summary>
Public DateTime publishtime
{
get {return _publishtime;}
Set {_publishtime = value;}
}
}
}