@@ -118,12 +118,11 @@ public void SetSubarray<T>(params T[] data) where T : struct
118
118
public void SetSubarray < T > ( ReadOnlySpan < T > data ) where T : struct
119
119
{
120
120
ErrorHandling . ThrowIfManagedType < T > ( ) ;
121
- var dataType = EnumUtil . TypeToDataType ( typeof ( T ) ) ;
122
121
( var domainType , var nDim ) = GetDomainInfo ( ) ;
123
122
124
- if ( dataType != domainType )
123
+ if ( EnumUtil . DataTypeToType ( domainType ) != typeof ( T ) )
125
124
{
126
- ThrowHelpers . ThrowTypeMismatch ( dataType ) ;
125
+ ThrowHelpers . ThrowTypeMismatch ( domainType ) ;
127
126
}
128
127
if ( data . Length != nDim * 2 )
129
128
{
@@ -141,23 +140,22 @@ public void SetSubarray<T>(ReadOnlySpan<T> data) where T : struct
141
140
private void ValidateLabelType < T > ( string name ) where T : struct
142
141
{
143
142
ErrorHandling . ThrowIfManagedType < T > ( ) ;
144
- var dataType = EnumUtil . TypeToDataType ( typeof ( T ) ) ;
145
143
using var schema = _array . Schema ( ) ;
146
144
using var label = schema . DimensionLabel ( name ) ;
147
- if ( label . DataType != dataType )
145
+ if ( EnumUtil . DataTypeToType ( label . DataType ) != typeof ( T ) )
148
146
{
149
- ThrowHelpers . ThrowTypeMismatch ( dataType ) ;
147
+ ThrowHelpers . ThrowTypeMismatch ( label . DataType ) ;
150
148
}
151
149
}
152
150
153
151
private void ValidateType < T > ( string name ) where T : struct
154
152
{
155
153
ErrorHandling . ThrowIfManagedType < T > ( ) ;
156
- var dataType = EnumUtil . TypeToDataType ( typeof ( T ) ) ;
157
154
using var schema = _array . Schema ( ) ;
158
155
using var domain = schema . Domain ( ) ;
159
156
using var dimension = domain . Dimension ( name ) ;
160
- if ( dimension . Type ( ) != dataType )
157
+ var dataType = dimension . Type ( ) ;
158
+ if ( EnumUtil . DataTypeToType ( dataType ) != typeof ( T ) )
161
159
{
162
160
ThrowHelpers . ThrowTypeMismatch ( dataType ) ;
163
161
}
@@ -166,11 +164,11 @@ private void ValidateType<T>(string name) where T : struct
166
164
private void ValidateType < T > ( uint index ) where T : struct
167
165
{
168
166
ErrorHandling . ThrowIfManagedType < T > ( ) ;
169
- var dataType = EnumUtil . TypeToDataType ( typeof ( T ) ) ;
170
167
using var schema = _array . Schema ( ) ;
171
168
using var domain = schema . Domain ( ) ;
172
169
using var dimension = domain . Dimension ( index ) ;
173
- if ( dimension . Type ( ) != dataType )
170
+ var dataType = dimension . Type ( ) ;
171
+ if ( EnumUtil . DataTypeToType ( dataType ) != typeof ( T ) )
174
172
{
175
173
ThrowHelpers . ThrowTypeMismatch ( dataType ) ;
176
174
}
0 commit comments