Sure Rajini..
Example:
//Note: In this example ICloneable interface (defined in .Net Framework) acts as Prototype
class ConcretePrototype : ICloneable
{
public int X { get; set; }
public ConcretePrototype(int x)
{
this.X = x;
}
public void PrintX()
{
Console.WriteLine("Value :" + X);
}
public object Clone()
{
return this.MemberwiseClone();
}
}
/**
* Client code
*/
public class PrototypeTest
{
public static void Main()
{
var prototype = new ConcretePrototype(1000);
for (int i = 1; i < 10; i++)
{
ConcretePrototype tempotype = prototype.Clone() as ConcretePrototype;
// Usage of values in prototype to derive a new value.
tempotype.X *= i;
tempotype.PrintX();
}
Console.ReadKey();
}
}
/*
**Code output**
Value :1000
Value :2000
Value :3000
Value :4000
Value :5000
Value :6000
Value :7000
Value :8000
Value :9000
*/
Regards,
Bharathi