LibraStack / UnityMvvmToolkit

Brings data-binding to your Unity project
MIT License
471 stars 27 forks source link

Collect only observable fields from ViewModel. #6

Closed ChebanovDD closed 1 year ago

ChebanovDD commented 1 year ago

Describe the bug

Private fields are not ignored when building the ViewModel.

Code example

public class MainViewModel : IBindingContext
{
    private readonly IProperty<int> _count = new Property<int>();

    public IReadOnlyProperty<int> Count => _count;
}

Current result

Exception: "ArgumentException: An item with the same key has already been added." will be thrown.

Expected result

The _count field should be ignored if it is private or not marked with the Observable attribute.