Skip to content

Commit

Permalink
Merge pull request #28 from BoBoBaSs84/docs/describe-the-attributes
Browse files Browse the repository at this point in the history
docs: describe the attributes
  • Loading branch information
BoBoBaSs84 authored Nov 6, 2023
2 parents 13c00dd + 267d110 commit 814363a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<VersionMajor>1</VersionMajor>
<VersionMinor>4</VersionMinor>
<VersionMinor>5</VersionMinor>
<VersionPatch>0</VersionPatch>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
<VersionSuffix Condition="$(Configuration.Equals('Debug'))">Development</VersionSuffix>
Expand Down
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,34 @@ Most of the implementation must be done despite the base class itself. The inten

Further implementation possibilities can be achieved with the interfaces `INotifyCollectionChanged` and `INotifyCollectionChanging`.

## The notification attributes

The `NotifyChangedAttribute` and the `NotifyChangingAttribute` propagating the information also to those properties the are defined via the constructor. An example implementation could look like this:

```csharp
private sealed class TestClass : NotifyPropertyBase
{
private int _quantity;
private int _value;

public TestClass(int quantity, int value)
{
Quantity = quantity;
Value = value;
}

[NotifyChanged(nameof(TotalValue))]
public int Quantity { get => _quantity; set => SetProperty(ref _quantity, value); }

[NotifyChanged(nameof(TotalValue))]
public int Value { get => _value; set => SetProperty(ref _value, value); }

public int TotalValue => Quantity * Value;
}
```

If the `Quantity` property or the `Value` property is changed, a `PropertyChanged` event is also triggered for the `TotalValue` property.

# Documentation

The API documentation can be found [here](https://bobobass84.github.io/BB84.Notifications/).

0 comments on commit 814363a

Please sign in to comment.