ObservableHelpers 2.0.10

.NET 6.0 .NET Standard 2.0
dotnet add package ObservableHelpers --version 2.0.10
NuGet\Install-Package ObservableHelpers -Version 2.0.10
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ObservableHelpers" Version="2.0.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ObservableHelpers --version 2.0.10
#r "nuget: ObservableHelpers, 2.0.10"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ObservableHelpers as a Cake Addin
#addin nuget:?package=ObservableHelpers&version=2.0.10

// Install ObservableHelpers as a Cake Tool
#tool nuget:?package=ObservableHelpers&version=2.0.10

Observable Helpers

Observable helpers with source generators and UI-safe property implementations. Can be used for any MVVM software architectural applications.

NuGets

Name Info
ObservableHelpers NuGet

Installation

// Install release version
Install-Package ObservableHelpers

// Install pre-release version
Install-Package ObservableHelpers -pre

Supported frameworks

.NET Standard 2.0 and above - see https://github.com/dotnet/standard/blob/master/docs/versions.md for compatibility matrix

Get Started

All observable events are executed on thread that was used to create the object instance. To use in UI safe updates, create the object instances at the UI thread or manually configure the ISyncObject.SyncOperation to use UI thread.

Usage

ObservableObject Sample

using ObservableHelpers;

namespace YourNamespace
{
    [ObservableObject]
    public partial class Dinosaur
    {
        [ObservableProperty]
        string? name;
        
        [ObservableProperty(Access = Access.PublicWithPrivateSetter)]
        string? family;
        
        [ObservableProperty]
        int height;
    }
}

Will Generate

using ObservableHelpers;

namespace YourNamespace
{
    public partial class Dinosaur
    {
        public string? Name
        {
            get => name;
            set
            {
                if (!EqualityComparer<string?>.Default.Equals(name, value))
                {
                    OnNameChanging(value);
                    OnPropertyChanging(nameof(Name));
                    name = value;
                    OnNameChanged(value);
                    OnPropertyChanged(nameof(Name));
                }
            }
        }
        
        public string? Family
        {
            get => family;
            private set
            {
                if (!EqualityComparer<string?>.Default.Equals(family, value))
                {
                    OnFamilyChanging(value);
                    OnPropertyChanging(nameof(Family));
                    family = value;
                    OnFamilyChanged(value);
                    OnPropertyChanged(nameof(Family));
                }
            }
        }
        
        public int Height
        {
            get => height;
            set
            {
                if (!EqualityComparer<int>.Default.Equals(height, value))
                {
                    OnHeightChanging(value);
                    OnPropertyChanging(nameof(Height));
                    height = value;
                    OnHeightChanged(value);
                    OnPropertyChanged(nameof(Height));
                }
            }
        }
    }
}

UI safe

using ObservableHelpers;

namespace YourNamespace
{
    public class Program
    {
        private Dinosaur dinosaur;

        public void UIThread()
        {
            dinosaur = new Dinosaur(); // Must be created on UI thread to synchronize events

            dinosaur.SynchronizeChangedEvent = true;
        }

        public void BackgroundThread()
        {
            dinosaur.PropertyChanged += (s, e) =>
            {
                // Executes on UI thread if dinosaur.SynchronizeChangedEvent is true (default false)
            }
            dinosaur.SynchronizedPropertyChanged += (s, e) =>
            {
                // Executed on UI thread
            }
            dinosaur.UnsynchronizedPropertyChanged += (s, e) =>
            {
                // Executed on current thread
            }
            dinosaur.Name = "Megalosaurus";
        }
    }
}

Code & Inspiration from the following:

Want To Support This Project?

All I have ever asked is to be active by submitting bugs, features, and sending those pull requests down!.

paypal

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.10 156 9/9/2022
2.0.9 268 9/8/2022
2.0.8 160 9/8/2022
2.0.7 171 9/8/2022
2.0.6 157 9/5/2022
2.0.6-prerelease.14 49 9/5/2022
2.0.6-prerelease.13 47 9/5/2022
2.0.6-prerelease.11 47 9/5/2022
2.0.6-prerelease.10 49 9/5/2022
2.0.6-prerelease.8 45 9/5/2022
2.0.6-prerelease.7 47 9/5/2022
2.0.6-prerelease.6 46 9/5/2022
2.0.6-prerelease.4 48 9/5/2022
2.0.6-prerelease 48 9/5/2022
2.0.5 148 9/4/2022
2.0.3 143 9/4/2022
2.0.1 144 9/4/2022
1.6.2 208 4/23/2022
1.6.1 190 4/22/2022
1.6.0 188 4/22/2022
1.5.5 612 3/7/2022
1.5.4 175 3/7/2022
1.5.3 167 3/7/2022
1.5.2 183 3/5/2022
1.5.1 187 2/23/2022
1.5.0 445 2/22/2022
1.4.8 268 2/21/2022
1.4.7 173 2/19/2022
1.4.6 184 2/19/2022
1.4.5 296 1/9/2022
1.4.4 197 1/9/2022
1.4.3 453 1/4/2022
1.4.2 207 1/2/2022
1.4.1 159 1/1/2022
1.4.0 152 1/1/2022
1.3.6 199 1/1/2022
1.3.5 257 12/25/2021
1.3.4 291 12/13/2021
1.3.3 172 12/6/2021
1.3.2 237 11/16/2021
1.3.1 229 11/16/2021
1.3.0 184 11/14/2021
1.2.7 195 11/10/2021
1.2.6 255 11/8/2021
1.2.5 186 11/3/2021
1.2.4 221 11/2/2021
1.2.3 218 10/26/2021
1.2.2 246 10/25/2021
1.2.1 192 10/21/2021
1.2.0 171 10/21/2021
1.1.12 779 9/1/2021
1.1.11 182 9/1/2021
1.1.10 190 9/1/2021
1.1.9 206 9/1/2021
1.1.8 577 8/26/2021
1.1.7 203 8/26/2021
1.1.6 205 8/26/2021
1.1.5 193 8/26/2021
1.1.4 197 8/26/2021
1.1.3 267 8/25/2021
1.1.2 185 8/25/2021
1.1.1 196 8/25/2021
1.1.0 180 8/25/2021
1.0.92 520 8/18/2021
1.0.91 510 8/9/2021
1.0.90 354 8/4/2021
1.0.89 256 7/19/2021
1.0.88 204 7/19/2021
1.0.87 661 7/3/2021
1.0.86 262 7/2/2021
1.0.85 251 7/1/2021
1.0.84 298 6/30/2021
1.0.83 231 6/28/2021
1.0.82 200 6/28/2021
1.0.81 417 6/27/2021
1.0.80 324 6/27/2021
1.0.79 316 6/27/2021
1.0.78 240 6/16/2021
1.0.77 647 6/16/2021
1.0.76 361 6/15/2021
1.0.75 431 6/15/2021
1.0.74 248 6/15/2021
1.0.73 259 6/15/2021
1.0.72 266 6/15/2021
1.0.71 270 6/15/2021
1.0.70 331 6/15/2021
1.0.69 210 6/15/2021
1.0.68 310 6/15/2021
1.0.67 262 6/14/2021
1.0.66 269 6/14/2021
1.0.65 407 6/14/2021
1.0.64 294 6/13/2021
1.0.63 224 6/13/2021
1.0.62 241 6/13/2021
1.0.61 270 6/13/2021
1.0.60 286 6/13/2021
1.0.59 245 6/13/2021
1.0.58 440 6/13/2021
1.0.57 320 6/12/2021
1.0.56 423 6/12/2021
1.0.55 283 6/12/2021
1.0.54 697 6/10/2021
1.0.53 278 6/10/2021
1.0.52 304 6/10/2021
1.0.51 267 6/10/2021
1.0.49 258 6/10/2021
1.0.48 240 6/9/2021
1.0.47 208 6/9/2021
1.0.46 200 6/9/2021
1.0.45 204 6/9/2021
1.0.44 200 6/9/2021
1.0.43 844 6/8/2021
1.0.42 851 6/6/2021
1.0.41 326 6/6/2021
1.0.40 332 6/6/2021
1.0.39 268 6/6/2021
1.0.38 206 6/6/2021
1.0.37 287 6/6/2021
1.0.36 220 6/6/2021
1.0.35 213 6/6/2021
1.0.34 289 6/6/2021
1.0.33 221 6/6/2021
1.0.32 368 6/5/2021
1.0.31 467 6/5/2021
1.0.30 356 6/5/2021
1.0.29 301 6/5/2021
1.0.28 318 6/4/2021
1.0.27 328 6/4/2021
1.0.26 207 6/4/2021
1.0.25 211 6/4/2021
1.0.24 222 6/4/2021
1.0.23 310 6/3/2021
1.0.22 452 6/3/2021
1.0.21 215 6/3/2021
1.0.20 411 6/2/2021
1.0.19 384 6/2/2021
1.0.18 201 6/2/2021
1.0.17 207 6/2/2021
1.0.16 1,127 5/20/2021
1.0.15 197 5/19/2021
1.0.14 196 5/18/2021
1.0.13 197 5/18/2021
1.0.12 222 5/18/2021
1.0.11 211 5/17/2021
1.0.10 413 5/13/2021
1.0.9 282 5/13/2021
1.0.8 206 5/13/2021
1.0.7 371 5/11/2021
1.0.6 187 5/11/2021
1.0.5 200 5/11/2021
1.0.4 200 5/11/2021
1.0.3 283 5/8/2021
1.0.2 230 5/8/2021
1.0.1 219 5/8/2021
1.0.0 274 5/8/2021

* Fixed ArgumentNullException wrong parameter names