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 7072753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:50:50+00:00 2026-05-28T05:50:50+00:00

I know the logical approach to this question … This is logically correct :

  • 0

I know the “logical approach” to this question …

This is logically correct:

public static Department FindDepartment(Employee emp)
{
    if(emp.ID > 500)
    {
         return new Department("Department for Over 500");
    }else{
         return new Department("Department for 500 and under");
    }
 }

… because the Department is really based off the Employee, whereas the following is logically incorrect:

public static int GetPlusOne(Employee emp)
{
     return emp.ID + 1;
}

… because the method really isn’t a function of an Employee … it’s just an integer modifier.

That all said (and feel free to point out if I’m in error on that for some reason), Is there any performance lost when passing the entire instance of Employee?

I have an underlying method that will be called most of the time from within a different class and so I’m trying to weigh performance vs. logical here. But if there’s nothing to be worried about performance-wise then the choice becomes logical (haha … punny).

  • 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-05-28T05:50:50+00:00Added an answer on May 28, 2026 at 5:50 am

    IF Employee is a class then .NET passes a reference (which is basically a pointer) and NOT the instance itself… so performance is rather similar to a real instance method (which too receives a reference to the instance as an implicit parameter called this).

    You can even define them as Extension Methods like:

    public static Department FindDepartment(this Employee emp)
    {
        if(emp.ID > 500)
        {
             return new Department("Department for Over 500");
        }else{
             return new Department("Department for 500 and under");
        }
    }
    

    then you call it like any instance method on an instance of Employee:

    Employee emp = ...;
    
    Department dep = emp.FindDepartment();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know it might sound like an odd question, but theres a logical explanation
I know in C like languages logical operators are evaluated one at a time
Know of any good libraries for this? I did some searches and didn't come
Know this might be rather basic, but I been trying to figure out how
I know this might be a no-brainer, but please read on. I also know
i have this issue working but i would like to know if there is
I would like to know the best approach to create a Common Information Model
Strange question, I know, but one thing I seem to be feeling with ASP.Net
I don't know exactly what to call this kind of application, but I'm looking
i know some of this,ex. __mod__ will be call / __eq__ will be call

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.