File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,12 @@ public static class UnitConverter
46
46
private static readonly Assembly UnitsNetAssembly = typeof ( Length ) . GetAssembly ( ) ;
47
47
48
48
private static readonly Type [ ] QuantityTypes = UnitsNetAssembly . GetTypes ( )
49
- . Where ( x => x . FullName . StartsWith ( QuantityNamespace ) )
49
+ . Where ( typeof ( IQuantity ) . IsAssignableFrom )
50
+ . Where ( x => x . IsClass || x . IsValueType ) // Future-proofing: we are discussing changing quantities from struct to class
50
51
. ToArray ( ) ;
51
52
52
53
private static readonly Type [ ] UnitTypes = UnitsNetAssembly . GetTypes ( )
53
- . Where ( x => x . FullName . StartsWith ( UnitTypeNamespace ) )
54
+ . Where ( x => x . Namespace == UnitTypeNamespace && x . IsEnum && x . Name . EndsWith ( "Unit" ) )
54
55
. ToArray ( ) ;
55
56
56
57
/// <summary>
You can’t perform that action at this time.
0 commit comments