@@ -13,6 +13,11 @@ public abstract class BaseService : IMixedRealityService, IMixedRealityServiceSt
13
13
{
14
14
public const uint DefaultPriority = 10 ;
15
15
16
+ public BaseService ( )
17
+ {
18
+ typeName = new [ ] { GetType ( ) . ToString ( ) } ;
19
+ }
20
+
16
21
#region IMixedRealityService Implementation
17
22
18
23
/// <inheritdoc />
@@ -68,12 +73,18 @@ public virtual void Destroy()
68
73
69
74
private bool ? isInitialized = null ;
70
75
76
+ private readonly string [ ] typeName = null ;
77
+
78
+ private const string IsInitializedAssert = "{0} has not set a value for IsInitialized; returning false." ;
79
+ private const string IsEnabledAssert = "{0} has not set a value for IsEnabled; returning false." ;
80
+ private const string IsMarkedDestroyedAssert = "{0} has not set a value for IsMarkedDestroyed; returning false." ;
81
+
71
82
/// <inheritdoc />
72
83
public virtual bool IsInitialized
73
84
{
74
85
get
75
86
{
76
- Debug . Assert ( isInitialized . HasValue , $ " { GetType ( ) } has not set a value for IsInitialized, returning false." ) ;
87
+ Debug . AssertFormat ( isInitialized . HasValue , IsInitializedAssert , typeName ) ;
77
88
return isInitialized ?? false ;
78
89
}
79
90
@@ -87,7 +98,7 @@ public virtual bool IsEnabled
87
98
{
88
99
get
89
100
{
90
- Debug . Assert ( isEnabled . HasValue , $ " { GetType ( ) } has not set a value for IsEnabled, returning false." ) ;
101
+ Debug . AssertFormat ( isEnabled . HasValue , IsEnabledAssert , typeName ) ;
91
102
return isEnabled ?? false ;
92
103
}
93
104
@@ -101,7 +112,7 @@ public virtual bool IsMarkedDestroyed
101
112
{
102
113
get
103
114
{
104
- Debug . Assert ( isMarkedDestroyed . HasValue , $ " { GetType ( ) } has not set a value for IsMarkedDestroyed, returning false." ) ;
115
+ Debug . AssertFormat ( isMarkedDestroyed . HasValue , IsMarkedDestroyedAssert , typeName ) ;
105
116
return isMarkedDestroyed ?? false ;
106
117
}
107
118
0 commit comments