55
66namespace ThunderDesign . Net . Threading . Attributes
77{
8+ #if NETSTANDARD2_0_OR_GREATER || NET6_0_OR_GREATER
89 [ AttributeUsage ( AttributeTargets . Field , Inherited = false , AllowMultiple = false ) ]
910 public sealed class BindablePropertyAttribute : Attribute
1011 {
@@ -22,56 +23,57 @@ public BindablePropertyAttribute(
2223 AccessorAccessibility getter = AccessorAccessibility . Public ,
2324 AccessorAccessibility setter = AccessorAccessibility . Public )
2425 {
25- ApplyBindablePropertyAttribute ( readOnly , threadSafe , notify , new string [ 0 ] , getter , setter ) ;
26+ ApplyBindablePropertyAttribute ( Array . Empty < string > ( ) , readOnly , threadSafe , notify , getter , setter ) ;
2627 }
2728
2829 public BindablePropertyAttribute (
30+ string alsoNotify ,
2931 bool readOnly = false ,
3032 bool threadSafe = true ,
3133 bool notify = true ,
32- string alsoNotify = null ,
3334 AccessorAccessibility getter = AccessorAccessibility . Public ,
3435 AccessorAccessibility setter = AccessorAccessibility . Public )
3536 {
36- ApplyBindablePropertyAttribute ( readOnly , threadSafe , notify , string . IsNullOrEmpty ( alsoNotify ) ? new string [ 0 ] : new string [ ] { alsoNotify } , getter , setter ) ;
37+ ApplyBindablePropertyAttribute ( string . IsNullOrEmpty ( alsoNotify ) ? Array . Empty < string > ( ) : new string [ 1 ] { alsoNotify } , readOnly , threadSafe , notify , getter , setter ) ;
3738 }
3839
3940 public BindablePropertyAttribute (
40- string [ ] alsoNotify = null ,
41+ string [ ] alsoNotify ,
4142 bool readOnly = false ,
4243 bool threadSafe = true ,
4344 bool notify = true ,
4445 AccessorAccessibility getter = AccessorAccessibility . Public ,
4546 AccessorAccessibility setter = AccessorAccessibility . Public )
4647 {
47- ApplyBindablePropertyAttribute ( readOnly , threadSafe , notify , alsoNotify ?? new string [ 0 ] , getter , setter ) ;
48+ ApplyBindablePropertyAttribute ( alsoNotify ?? Array . Empty < string > ( ) , readOnly , threadSafe , notify , getter , setter ) ;
4849 }
4950
5051 public BindablePropertyAttribute (
52+ IEnumerable < string > alsoNotify ,
5153 bool readOnly = false ,
5254 bool threadSafe = true ,
53- IEnumerable < string > alsoNotify = null ,
5455 AccessorAccessibility getter = AccessorAccessibility . Public ,
5556 AccessorAccessibility setter = AccessorAccessibility . Public ,
5657 bool notify = true )
5758 {
58- ApplyBindablePropertyAttribute ( readOnly , threadSafe , notify , alsoNotify ? . ToArray ( ) ?? new string [ 0 ] , getter , setter ) ;
59+ ApplyBindablePropertyAttribute ( alsoNotify ? . ToArray ( ) ?? Array . Empty < string > ( ) , readOnly , threadSafe , notify , getter , setter ) ;
5960 }
6061
61- public void ApplyBindablePropertyAttribute (
62- bool readOnly = false ,
63- bool threadSafe = true ,
64- bool notify = true ,
65- string [ ] alsoNotify = null ,
66- AccessorAccessibility getter = AccessorAccessibility . Public ,
67- AccessorAccessibility setter = AccessorAccessibility . Public )
62+ private void ApplyBindablePropertyAttribute (
63+ string [ ] alsoNotify ,
64+ bool readOnly ,
65+ bool threadSafe ,
66+ bool notify ,
67+ AccessorAccessibility getter ,
68+ AccessorAccessibility setter )
6869 {
6970 ReadOnly = readOnly ;
7071 ThreadSafe = threadSafe ;
7172 Notify = notify ;
72- AlsoNotify = alsoNotify ?? new string [ 0 ] ;
73+ AlsoNotify = alsoNotify ;
7374 Getter = getter ;
7475 Setter = setter ;
7576 }
7677 }
78+ #endif
7779}
0 commit comments