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

  • Home
  • SEARCH
  • 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 7707577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:23:45+00:00 2026-06-01T00:23:45+00:00

Maybe I am overlooking something obvious, but I have seen in code where you

  • 0

Maybe I am overlooking something obvious, but I have seen in code where you may have a property like “HairColor”, and then a method like “HairColor.Update()”. Is this possible?

Person person = new Person(int personID);
person.HairColor = "Blonde";
person.HairColor.Update();

I have specific properties that I want to be able to extend on a case by case basis. I guess I could have a method called “HairColorUpdate”, but seems that HairColor.Update() should be possible. I don’t want to use “set” because I don’t always want to update the DB this way.

The reason I am doing this is because I may only want to call the database to update one column instead of calling my save method which updates every column hopefully improving efficiency.

  • 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-01T00:23:47+00:00Added an answer on June 1, 2026 at 12:23 am

    person.HairColor.Update() just means that the type returned by the HairColor property has a method called Update. In your example it looks like HairColor is a string, so to achieve that you need to implement an extension method for string. E.g. something like

    static class StringExtension
    {
        public static void Update(this string s)
        {
            // whatever
        }
    }
    

    However, I don’t see the point of doing this. The Update method is a static method that works on the string, so it doesn’t affect the Person instance. (even if string did have an Update method it would be unrelated to the Person type).

    I believe you would want to have the Update method on Person instead as others have pointed out.

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

Sidebar

Related Questions

Maybe I am overlooking something very easy and obvious... I have a method interface
I am probably overlooking something obvious but then maybe someone else will too. I'm
I'm new to PHP so maybe I am overlooking something here but the following:
maybe I'm drastically overlooking something trivial, but is there any possibility in Vim (with
Maybe I just don't know .NET well enough yet, but I have yet to
Maybe world peace would be easier, but I have a problem with the widths
Maybe this is a dumb question, but I have the following behavior in Visual
I'm sure I'm overlooking the obvious as I've got countless working buttons...but...for whatever reason
This may be something very easy but i can't seem to get this to
Probably I'm being stupid and overlooking something, but I am having a bizarre issue

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.