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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -