@@ -118,12 +118,11 @@ public void SetSubarray<T>(params T[] data) where T : struct
118118 public void SetSubarray < T > ( ReadOnlySpan < T > data ) where T : struct
119119 {
120120 ErrorHandling . ThrowIfManagedType < T > ( ) ;
121- var dataType = EnumUtil . TypeToDataType ( typeof ( T ) ) ;
122121 ( var domainType , var nDim ) = GetDomainInfo ( ) ;
123122
124- if ( dataType != domainType )
123+ if ( EnumUtil . DataTypeToType ( domainType ) != typeof ( T ) )
125124 {
126- ThrowHelpers . ThrowTypeMismatch ( dataType ) ;
125+ ThrowHelpers . ThrowTypeMismatch ( domainType ) ;
127126 }
128127 if ( data . Length != nDim * 2 )
129128 {
@@ -141,23 +140,22 @@ public void SetSubarray<T>(ReadOnlySpan<T> data) where T : struct
141140 private void ValidateLabelType < T > ( string name ) where T : struct
142141 {
143142 ErrorHandling . ThrowIfManagedType < T > ( ) ;
144- var dataType = EnumUtil . TypeToDataType ( typeof ( T ) ) ;
145143 using var schema = _array . Schema ( ) ;
146144 using var label = schema . DimensionLabel ( name ) ;
147- if ( label . DataType != dataType )
145+ if ( EnumUtil . DataTypeToType ( label . DataType ) != typeof ( T ) )
148146 {
149- ThrowHelpers . ThrowTypeMismatch ( dataType ) ;
147+ ThrowHelpers . ThrowTypeMismatch ( label . DataType ) ;
150148 }
151149 }
152150
153151 private void ValidateType < T > ( string name ) where T : struct
154152 {
155153 ErrorHandling . ThrowIfManagedType < T > ( ) ;
156- var dataType = EnumUtil . TypeToDataType ( typeof ( T ) ) ;
157154 using var schema = _array . Schema ( ) ;
158155 using var domain = schema . Domain ( ) ;
159156 using var dimension = domain . Dimension ( name ) ;
160- if ( dimension . Type ( ) != dataType )
157+ var dataType = dimension . Type ( ) ;
158+ if ( EnumUtil . DataTypeToType ( dataType ) != typeof ( T ) )
161159 {
162160 ThrowHelpers . ThrowTypeMismatch ( dataType ) ;
163161 }
@@ -166,11 +164,11 @@ private void ValidateType<T>(string name) where T : struct
166164 private void ValidateType < T > ( uint index ) where T : struct
167165 {
168166 ErrorHandling . ThrowIfManagedType < T > ( ) ;
169- var dataType = EnumUtil . TypeToDataType ( typeof ( T ) ) ;
170167 using var schema = _array . Schema ( ) ;
171168 using var domain = schema . Domain ( ) ;
172169 using var dimension = domain . Dimension ( index ) ;
173- if ( dimension . Type ( ) != dataType )
170+ var dataType = dimension . Type ( ) ;
171+ if ( EnumUtil . DataTypeToType ( dataType ) != typeof ( T ) )
174172 {
175173 ThrowHelpers . ThrowTypeMismatch ( dataType ) ;
176174 }
0 commit comments