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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:34:40+00:00 2026-05-10T20:34:40+00:00

I have a class that has some properties. And I want something that calculates

  • 0

I have a class that has some properties. And I want something that calculates a Score out of these properties. Since this is a trivial task (some additions and divisions, but nothing spectacular).

So naturally, the question is: ‘When to use a Property with some code in the getter, and when to use a function?’, and that question was already answered.

Now, I wonder about one thing though: If – against all expectations – I ever needed to make this Getter so complicated that it should be a function (for example, because I need to put data in or because it can throw an exception or whatever), is it easy to change a Property into a Method?

Of course, it seems really trivial, just changing

public double Score {     get {         return Math.Round(A + B / C * D,3);     } } 

to

public double Score(){     return Math.Round(A + B / C * D,3); } 

But I wonder: Are there any side effects? Is anything going to break when changing stuff around like this? I can only ever see this as a possible problem when Reflection is involved, but what in situations where I have 2 Assemblies – one that defines the class and one that uses the class – and only change the one that contains the class without recompiling the consumer assembly. Is that a possible source of ‘weird bugs that are nearly impossible to track’ or is it completely safe to change Properties to Methods?

  • 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. 2026-05-10T20:34:41+00:00Added an answer on May 10, 2026 at 8:34 pm

    No. There are no side affects to this at all.

    Pull up reflector, you’ll see that your properties already are methods

    Under the hood the get and set accessors in a property are simply converted to get_MyPropertyName() and set_MyPropertyName() methods. This is also why you can (but typically shouldn’t) add parameters to a property.

    The only ‘gotcha’ is that in C# you will need to add ‘()’ to any existing calls.

    Also

    according to the coding guidelines, a property name usually is noun (i.e. Score), but methods should describe actions (verb), so more proper name is GetScore() or CalculateScore()

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

Sidebar

Ask A Question

Stats

  • Questions 78k
  • Answers 78k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You could write an custom content processor to handle your… May 11, 2026 at 3:39 pm
  • added an answer Actually Firefox plugins (such as Flash, Java and video codec… May 11, 2026 at 3:39 pm
  • added an answer Statements cannot go inside of expressions in Python; it was… May 11, 2026 at 3:39 pm

Related Questions

I have a web-app-database 3 tier server setup. Web requests data from app, and
I'm using C#. I have a products class with fields like sku, name, description....
I have a command-line utility that gets quite a bit of downloads from my
I have a project for which we are extending some functionality from an existing

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.