I have a class that has some methods, which I use in code. Their aim is to generate an object and return it for further usage. I can implement it in two ways. The first way - is to make it static, like this:
public static class Builder
{
public static MyObject BuildMyObject(Settings myEnumSetting, int someParam)
{
//Building object
return MyObject;
}
//Other methods
}
Other way - is to make it instance like this:
public class Builder
{
public MyObject BuildMyObject(Settings myEnumSetting, int someParam)
{
//Building object
return MyObject;
}
//Other methods
}
In the first way can create my objects like this:
MyObject obj = Builder.BuildMyObject(Settings.Worker,20);
In the second case I can use it like this:
MyObject obj = new Builder().BuildMyObject(Settings.Worker,20);
Which of these approaches it more efficient for usage?