I am in a situation that i should duplicate some code. My code is in C#. So Here is my code:
public class Test
{
public object Project1()
{
return new
{
Field1 = 1,
Field2 = 2,
Field3 = 3,
Field4 = 4
};
}
public object Project2()
{
return new
{
Field1 = 1,
Field2 = 2,
Field3 = 3,
Field4 = 4,
Field5 = 5,
Field6 = 6,
Field7 = 7,
Field8 = 8
};
}
public object Project3()
{
return new
{
Field1 = 1,
Field2 = 2,
Field3 = 3,
Field4 = 4,
Field5 = 5,
Field6 = 6,
Field7 = 7,
Field9 = 9,
Field10 = 10,
Field11 = 11,
Field12 = 12
};
}
}
I am searching for a good pattern if exists or not a good solution will be appreciated.
Aucun commentaire:
Enregistrer un commentaire