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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:37:45+00:00 2026-05-24T08:37:45+00:00

Assume we have following pseudocode: class XY { int X { get; set; }

  • 0

Assume we have following pseudocode:

class XY
{
    int X { get; set; }
    int Y { get; set; }
}
class Foo
{
    XY _xy;
    XY xy
    {
        get 
        {
            return _xy;
        }
        set
        {
            Write("Foo's XY is set!");
            _xy = value;
        }
    }
}

This works fine as long as I’m doing

Foo foo;
foo.xy = XY(1, 3);
XY temp = foo.xy;
temp.y = 5;
foo.xy = temp;

but doesn’t work for:

Foo foo;
foo.xy = XY(1, 3);
foo.xy.y = 5;      // no "Foo's XY is set!" here

How the latter can be achieved? Specifically I mean Lua (with _index/_newindex) but I’m writing example code in C#ish language because I think most people know it well and I believe this is more generic programming problem.

  • 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-24T08:37:46+00:00Added an answer on May 24, 2026 at 8:37 am

    Why would it? You didn’t set Foo.xy. You should implement some kind of notification to the base object if you want to achieve that.

    In C# the common pattern is implementing INotifyPropertyChanged interface on XY and subscribing Foo to it.

    Example:

    class XY: INotifyPropertyChanged
    {
        public X { get {...} set { _x = value; PropertyChanged("X"); }}
        // implementation of interface...
    }
    
    class Foo
    {
         public Foo(XY xy)
         {
              this._xy = xy;
              this._xy.PropertyChanged += delegate { Console.WriteLine("changed"); }
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume I have the following code: public static class Foo { public static void
Assume I have the following rules: unify('test', 'this is a test'). run :- write('Enter
Assume I have a class foo, and wish to use a std::map to store
Assume I have a function template like this: template<class T> inline void doStuff(T* arr)
Assume I have the following query: Update LPMBonusReport Set BoxID = (Select ContainerSerialNumber From
Lets assume we have the following array var arr = new string[] {foo,bar,jar,\r,a,b,c,\r,x,y,z,\r); Also
Let's assume we have the following class : public class ImageButton extends MovieClip {
Assume i have the following decimal value: 4.584406 I need a simple quick way
Let us assume I have a to be tested class that has the following
Assume we have following JPA Entities: class Parent { @Id private Long id; }

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.