Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7728445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:43:10+00:00 2026-06-01T05:43:10+00:00

During a code review I presented a method quickly to the team that I

  • 0

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;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:43:11+00:00Added an answer on June 1, 2026 at 5:43 am

    Making private methods static is a form of micro-optimization; the method call is slightly faster. But the difference is almost too small to be meaningful.

    Generally speaking, you should mark a method static when it:

    1. Doesn’t interact in any way with instance members, and
    2. You would like to have the ability to call it without instantiating the class, as in Class.Method()

    Ordinarily, methods like your example would go into their own static helper class, if they are used in more than one place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

During a code review I've come across some code that defines a simple structure
During a code review, a senior dev commented on some nesting I had going
A question came up during a code review the other day about how quickly
During code review I discovered many places of our C# code that looks like
During a recent code review a colleague suggested that, for class with 4 int
How can I know during runtime that my code threw a Warning? example try
During testing, I'm stuck with testing a piece of code that receives a list
I found some confusing code during code review and am a bit puzzled. Doing
During a code review with a Microsoft employee we came across a large section
I saw some code as below during a peer-code-review session: char *s = new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.