c# - Factory Pattern - with optional parameters -


i have factory:

  public static class adapterfactory   {      public static iadapter getadapter(adaptertype claimtype, int mid, int tid, int siteid, string version)     {     } } 

my problem mid, tid, siteid , version parameters not needed construct "adapter", specific kinds of adapters.

what best approach when parameters not required in situation?

thanks help.

specalise , make more factories, example:

public static class midadapterfactory {     public static iadapter getadapter(adaptertype claimtype, int mid)     {     } }  public static class tidadapterfactory {     public static iadapter getadapter(adaptertype claimtype, int tid)     {     } } 

also consider builder pattern.


Comments