Conventions for order of parameters in a function

Posted by Andy on Stack Overflow See other posts from Stack Overflow or by Andy
Published on 2010-05-09T04:07:55Z Indexed on 2010/05/09 4:18 UTC
Read the original article Hit count: 351

Filed under:
|

In writing functions my brain always spends a few milliseconds to check which order of parameters would be best for a given function.

should I write:

    public Comment AddComment(long userID, string title, string text)

Or probably:

    public Comment AddComment(string title, string text, long userID)

Why not:

    public Comment AddComment(string title, long userID, string text)

Do you follow any rules when ordering the parameters for your functions? Which parameter would you place first and which would follow?

© Stack Overflow or respective owner

Related posts about parameters

Related posts about functions