public static LinearUnit CreateLinearUnit( int factoryCode )
Public Overloads Shared Function CreateLinearUnit( _ ByVal factoryCode As Integer _ ) As LinearUnit
Parameters
- factoryCode
- The linear unit factory code
public static LinearUnit CreateLinearUnit( int factoryCode )
Public Overloads Shared Function CreateLinearUnit( _ ByVal factoryCode As Integer _ ) As LinearUnit
Exception | Description |
---|---|
System.ArgumentException | The factoryCode is not a valid linear unit code. |
The available linear units of measure.
Factory Code | Unit Name |
---|---|
9001 | International meter |
9002 | International foot |
9003 | US survey foot |
9005 | Clarke's foot |
9014 | Fathom |
9030 | International nautical mile |
9031 | German legal meter |
9033 | US survey chain |
9034 | US survey link |
9035 | US survey mile |
9036 | Kilometer |
9037 | Yard (Clarke's ratio) |
9038 | Chain (Clarke's ratio) |
9039 | Link (Clarke's ratio) |
9040 | Yard (Sears) |
9041 | Sear's foot |
9042 | Chain (Sears) |
9043 | Link (Sears) |
9050 | Yard (Benoit 1895 A) |
9051 | Foot (Benoit 1895 A) |
9052 | Chain (Benoit 1895 A) |
9053 | Link (Benoit 1895 A) |
9060 | Yard (Benoit 1895 B) |
9061 | Foot (Benoit 1895 B) |
9062 | Chain (Benoit 1895 B) |
9063 | Link (Benoit 1895 B) |
9070 | Foot (1865) |
9080 | Indian geodetic foot |
9081 | Indian foot (1937) |
9082 | Indian foot (1962) |
9083 | Indian foot (1975) |
9084 | Indian yard |
9085 | Indian yard (1937) |
9086 | Indian yard (1962) |
9087 | Indian yard (1975) |
9093 | Statute mile |
9094 | Gold Coast foot |
9095 | British foot (1936) |
9096 | International yard |
109002 | US survey yard |
109003 | International Chain |
109004 | International Link |
109005 | Decimeter |
109006 | Centimeter |
109007 | Millimeter |
109008 | International inch |
109009 | US survey inch |
109010 | International rod |
109011 | US survey rod |
109012 | US nautical mile (pre 1954) |
109013 | UK nautical mile (pre 1970) |
109016 | Point |
109030 | 50 kilometer length |
109031 | 150 kilometer length |
109406 | US square foot |
try { // create a british 1936 foot var britFoot = LinearUnit.CreateLinearUnit(9095); string unitName = britFoot.Name; // "Foot_British_1936" double conversionFactor = britFoot.ConversionFactor; // 0.3048007491 double metersPerUnit = britFoot.MetersPerUnit; int factoryCode = britFoot.FactoryCode; // 9095 // convert 10 british 1936 feet to centimeters double val = britFoot.ConvertTo(10, LinearUnit.Centimeters); // convert 10 m to british 1936 feet val = britFoot.ConvertFromMeters(10); } catch (ArgumentException) { // ArgumentException will be thrown by CreateLinearUnit // in the following scenarios: // - if the factory code used is a non-linear factory code // (i.e. it corresponds to square meters which is an area unit code) // - if the factory code used is invalid // (i.e. it is negative or doesn't correspond to any factory code) }
Target Platforms: Windows 11, Windows 10