Skip to content

Instantly share code, notes, and snippets.

@chamook
Created November 29, 2016 08:16
Show Gist options
  • Select an option

  • Save chamook/a4520308344b68fe72f2762409e7a342 to your computer and use it in GitHub Desktop.

Select an option

Save chamook/a4520308344b68fe72f2762409e7a342 to your computer and use it in GitHub Desktop.
public class ThingFactory
{
public string ThingName { get; }
public string ThingValue { get; }
public ThingFactory(string thingName, int thingValue)
{
if (thingName == null)
throw new ArgumentNullException(nameof(thingName));
ThingName = thingName;
ThingValue = thingValue;
}
public Thing MakeThing(string elusiveThirdParameter)
{
if (elusiveThirdParameter == null)
throw new ArgumentNullException(nameof(elusiveThirdParameter));
return new Thing(ThingName, ThingValue, elusiveThirdParameter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment