oop - .NET Best Practice or Framework Example: Function Overload vs. New Method? -


disclaimer: not wish become opinion-based question. looking an example in .net framework library or a .net best practice resolves question.

i designing class , typically caller needs send single foo, on occasion caller need send multiple foos @ once:

edit: there other parameters foo , foo[]. apologies - trying generic.

i have methods (separate methods):

int sendfoo(foo foo, int timeout)  int sendfoos(foo[] foos, int timeout) 

but thought perhaps should go way (function overload):

int sendfoo(foo foo, int timeout)  int sendfoo(foo[] foos, int timeout) 

i'm leaning quite heavily toward function overload solution believe i've seen before, proof correct decision.

i cannot recall of similar example in .net framework libraries or if there existing .net best practice scenario.

thank time.

edit in response using params:

i cannot use params following reasons:

  1. sending multiple foo objects requires special processing can not bypass.
  2. i using other arguments in method not foo type.

examples of overloading:

examples of using differently named methods:


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -