Use [Property] Attribute (PropertyAttribute.cs) for overriding a property's getter and setter methods instead of having backing fields and using the ObservableObject::Set<T>(ref T t, T value) function.
Before:
private string _username;
public string Username
{
get => _username;
set => Set(ref _username, value);
}
After:
[Property]
public string Username { get; set; }
Pro:
Much cleaner code
More maintainable code (less backing field or get & set pollution)
Does not really work in .NET, because this approach requires either an assembly weaver (like Fody) or a macro (which has limited functionality in .NET)
Use
[Property]
Attribute (PropertyAttribute.cs
) for overriding a property's getter and setter methods instead of having backing fields and using theObservableObject::Set<T>(ref T t, T value)
function.Before:
After:
Pro:
get
&set
pollution)Con: