title: WPF/UWP: What is the difference between DependencyObject's GetValue() and ReadLocalValue()?
body: <p>I'm a WPF developer. I'm curious to know, what is the difference between the <code>GetValue</code> and <code>ReadLocalValue</code> methods for <code>DependencyObject</code>? I know that <code>GetValue</code> can be used to implement a dependency property, like this:</p>
  
  <pre><code>public static DependencyProperty FoobarProperty =
       DependencyProperty.Register(nameof(Foobar),
           typeof(int),
           typeof(DeclaringClass),
           new PropertyMetadata(0, OnFoobarChanged));
  
  public int Foobar
  {
       get { return (int)GetValue(FoobarProperty); }
       set { SetValue(FoobarProperty, value); }
  }
  
  private static void OnFoobarChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
  {
       var newValue = (int)e.NewValue;
      // do something with the new value...
  }
  </code></pre>
  
  <p>In a simple explanation, what purpose does <code>ReadLocalValue</code> serve? All I can garner from the <a href="https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.dependencyobject.readlocalvalue#examples" rel="nofollow">MSDN sample</a> is that it may return <code>DependencyProperty.UnsetValue</code>, which doesn't really tell much.</p>