Would you make this method Static or not?

Posted by Adam Drummond on Stack Overflow See other posts from Stack Overflow or by Adam Drummond
Published on 2012-04-02T22:49:03Z Indexed on 2012/04/02 23:30 UTC
Read the original article Hit count: 188

Filed under:
|
|
|

During a code review I presented a method quickly to the team that I had made static and one person agreed that there was no reason for it to not be static and a person disagreed saying that he would not make it static because it wasn't necessary and just to be on the safe side for future modifications and testing.

So I did quite a bit of research and obviously it's a specialized case but I would like to know what you would do in this situation and why?

(Its basically a helper method I call from a few different methods, a very low traffic page. More for my knowledge and learning on Static.)

private IEnumerable<Category> GetCategoryByID(int id, Context context)
{
    var categoryQuery = from selectAllProc in context.SelectAll_sp()
                        where selectAllProc.CategoryID == id
                        select selectAllProc;
    return categoryQuery;
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET