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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:24:14+00:00 2026-05-23T11:24:14+00:00

Is there a difference between this two variants (performance, memory leaks or guidelines)? With

  • 0

Is there a difference between this two variants (performance, memory leaks or guidelines)?

With NPC:

private ICommand mGoBackCommand;

    public ICommand GoBackCommand
    {
        get { return mGoBackCommand; }
        set
        {
            if (mGoBackCommand != value)
            {
                mGoBackCommand = value;
                RaisePropertyChanged("GoBackCommand");
            }
        }
    }

Auto property:

public ICommand GoBackCommand {get; set;}

UPD:
Final question is:
Can I use auto properties in VievModel if they are simple commands which will be assigned once in constructor, or I need implement NPC on each property of the VM because of performance, memory leaks or something else?

  • 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-23T11:24:15+00:00Added an answer on May 23, 2026 at 11:24 am

    If you are writing a class that implements INotifyPropertyChanged, you are making a contract that says “I’ll raise the PropertyChanged event when any property changes.”

    But, if you know for a fact that a property won’t change during the lifetime of the instance, then you trivially satisfy that contract by never raising PropertyChanged for that property.

    So, if you set a property once in the constructor (a “set it a forget it” property), then you don’t need to mangle the property just to support INotifyPropertyChanged and you can use an auto-implemented property. However, in this you should change the property from this:

    public ICommand GoBackCommand { get; set; }
    

    to this:

    public ICommand GoBackCommand { get; private set; }
    

    so that it cannot be accidentally modified outside the class.

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

Sidebar

Related Questions

In Java, is there any difference between this two function declarations? public void foo()
I'm just curious: Is there a difference on speed and performance between this two
This might be a simple question: Is there any difference between the two folowing:
Is there a difference between the following two snippets for this given class? class
Is there any essential difference between this code: ThreadStart starter = new ThreadStart(SomeMethod); starter.Invoke();
Is there a difference between Cursor.Current and this.Cursor (where this is a WinForm) in
The docs aren't entirely clear on this - is there a difference between these
Is there a difference between the two examples below for beginning a Perl script?
Is there a difference between the two codes below, I presume not. function Agent(bIsSecret)
I'd like to know the difference between this two syntaxes: return db.Contacts.First(x => x.ContactID

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.