Returns the design mode (C #) series Article index
Introduced
The use of sharing technology to effectively support a large number of fine-grained objects.
Example
There is a message entity class, and some objects have insert () and get () methods for its operations, and now use shared technology to support these objects.
Messagemodel
using System;
using System.Collections.Generic;
using System.Text;
Namespace Pattern.flyweight
{
/**////<summary>
///message entity class
///</summary>
public class Messagemodel
{
/**////<summary>
///constructor
///</summary>
/ <param name= "msg" >message content </param>
///<param name= "PT" >message release time </param>
Pu Blic 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;}
}
}
}