Skip to content

Commit a0a07c3

Browse files
committed
Attempt to fix #13 VS2010, C# compiler error caused by passing default string parameter to attribute
#13 Tried workaround casting explicitly to (string), as described in http://stackoverflow.com/a/8299981/134761.
1 parent 58780d1 commit a0a07c3

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

Src/UnitsNet/Attributes.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace UnitsNet
2929
// public new const Unit BaseUnit = Unit.Meter;
3030
// public new const string XmlDocSummary = "Foo description";
3131

32-
// public FooAttribute(double ratio, string pluralName = null) : base(pluralName, ratio)
32+
// public FooAttribute(double ratio, string pluralName = (string)null) : base(pluralName, ratio)
3333
// {
3434
// }
3535
//}
@@ -38,9 +38,8 @@ namespace UnitsNet
3838
public class AngleAttribute : UnitAttribute
3939
{
4040
public new const Unit BaseUnit = Unit.Degree;
41-
public new const string XmlDocSummary = "In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle.";
42-
43-
public AngleAttribute(double ratio, string pluralName = null) : base(pluralName, ratio)
41+
public new const string XmlDocSummary = "In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle.";
42+
public AngleAttribute(double ratio, string pluralName = (string)null) : base(pluralName, ratio)
4443
{
4544
}
4645
}
@@ -50,7 +49,7 @@ public class AreaAttribute : UnitAttribute
5049
{
5150
public new const Unit BaseUnit = Unit.SquareMeter;
5251
public new const string XmlDocSummary = "Area is a quantity that expresses the extent of a two-dimensional surface or shape, or planar lamina, in the plane. Area can be understood as the amount of material with a given thickness that would be necessary to fashion a model of the shape, or the amount of paint necessary to cover the surface with a single coat.[1] It is the two-dimensional analog of the length of a curve (a one-dimensional concept) or the volume of a solid (a three-dimensional concept).";
53-
public AreaAttribute(double ratio, string pluralName = null) : base(pluralName, ratio)
52+
public AreaAttribute(double ratio, string pluralName = (string)null) : base(pluralName, ratio)
5453
{
5554
}
5655
}
@@ -60,7 +59,7 @@ public class ElectricPotentialAttribute : UnitAttribute
6059
{
6160
public new const Unit BaseUnit = Unit.Volt;
6261
public new const string XmlDocSummary = "In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point.";
63-
public ElectricPotentialAttribute(double ratio, string pluralName = null) : base(pluralName, ratio)
62+
public ElectricPotentialAttribute(double ratio, string pluralName = (string)null) : base(pluralName, ratio)
6463
{
6564
}
6665
}
@@ -70,7 +69,7 @@ public class FlowAttribute : UnitAttribute
7069
{
7170
public new const Unit BaseUnit = Unit.CubicMeterPerSecond;
7271
public new const string XmlDocSummary = "In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m3·s−1 (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft3/s (cubic feet per second). It is usually represented by the symbol Q.";
73-
public FlowAttribute(double ratio, string pluralName = null) : base(pluralName, ratio)
72+
public FlowAttribute(double ratio, string pluralName = (string)null) : base(pluralName, ratio)
7473
{
7574
}
7675
}
@@ -80,7 +79,7 @@ public class ForceAttribute : UnitAttribute
8079
{
8180
public new const Unit BaseUnit = Unit.Newton;
8281
public new const string XmlDocSummary = "In physics, a force is any influence that causes an object to undergo a certain change, either concerning its movement, direction, or geometrical construction. In other words, a force can cause an object with mass to change its velocity (which includes to begin moving from a state of rest), i.e., to accelerate, or a flexible object to deform, or both. Force can also be described by intuitive concepts such as a push or a pull. A force has both magnitude and direction, making it a vector quantity. It is measured in the SI unit of newtons and represented by the symbol F.";
83-
public ForceAttribute(double ratio, string pluralName = null) : base(pluralName, ratio)
82+
public ForceAttribute(double ratio, string pluralName = (string)null) : base(pluralName, ratio)
8483
{
8584
}
8685
}
@@ -90,7 +89,7 @@ public class LengthAttribute : UnitAttribute
9089
{
9190
public new const Unit BaseUnit = Unit.Meter;
9291
public new const string XmlDocSummary = "Many different units of length have been used around the world. The main units in modern use are U.S. customary units in the United States and the Metric system elsewhere. British Imperial units are still used for some purposes in the United Kingdom and some other countries. The metric system is sub-divided into SI and non-SI units.";
93-
public LengthAttribute(double ratio, string pluralName = null) : base(pluralName, ratio)
92+
public LengthAttribute(double ratio, string pluralName = (string)null) : base(pluralName, ratio)
9493
{
9594
}
9695
}
@@ -100,7 +99,7 @@ public class MassAttribute : UnitAttribute
10099
{
101100
public new const Unit BaseUnit = Unit.Kilogram;
102101
public new const string XmlDocSummary = "In physics, mass (from Greek μᾶζα \"barley cake, lump [of dough]\") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg).";
103-
public MassAttribute(double ratio, string pluralName = null) : base(pluralName, ratio)
102+
public MassAttribute(double ratio, string pluralName = (string)null) : base(pluralName, ratio)
104103
{
105104
}
106105
}
@@ -110,7 +109,7 @@ public class PressureAttribute : UnitAttribute
110109
{
111110
public new const Unit BaseUnit = Unit.Pascal;
112111
public new const string XmlDocSummary = "Pressure (symbol: P or p) is the ratio of force to the area over which that force is distributed. Pressure is force per unit area applied in a direction perpendicular to the surface of an object. Gauge pressure (also spelled gage pressure)[a] is the pressure relative to the local atmospheric or ambient pressure. Pressure is measured in any unit of force divided by any unit of area. The SI unit of pressure is the newton per square metre, which is called the pascal (Pa) after the seventeenth-century philosopher and scientist Blaise Pascal. A pressure of 1 Pa is small; it approximately equals the pressure exerted by a dollar bill resting flat on a table. Everyday pressures are often stated in kilopascals (1 kPa = 1000 Pa).";
113-
public PressureAttribute(double ratio, string pluralName = null) : base(pluralName, ratio)
112+
public PressureAttribute(double ratio, string pluralName = (string)null) : base(pluralName, ratio)
114113
{
115114
}
116115
}
@@ -120,7 +119,7 @@ public class RotationalSpeedAttribute : UnitAttribute
120119
{
121120
public new const Unit BaseUnit = Unit.RevolutionPerSecond;
122121
public new const string XmlDocSummary = "Rotational speed (sometimes called speed of revolution) is the number of complete rotations, revolutions, cycles, or turns per time unit. Rotational speed is a cyclic frequency, measured in radians per second or in hertz in the SI System by scientists, or in revolutions per minute (rpm or min-1) or revolutions per second in everyday life. The symbol for rotational speed is ω (the Greek lowercase letter \"omega\").";
123-
public RotationalSpeedAttribute(double ratio, string pluralName = null)
122+
public RotationalSpeedAttribute(double ratio, string pluralName = (string)null)
124123
: base(pluralName, ratio)
125124
{
126125
}
@@ -131,7 +130,7 @@ public class TorqueAttribute : UnitAttribute
131130
{
132131
public new const Unit BaseUnit = Unit.Newtonmeter;
133132
public new const string XmlDocSummary = "Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis,[1] fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or tightens the nut or bolt.";
134-
public TorqueAttribute(double ratio, string pluralName = null) : base(pluralName, ratio)
133+
public TorqueAttribute(double ratio, string pluralName = (string)null) : base(pluralName, ratio)
135134
{
136135
}
137136
}
@@ -141,7 +140,7 @@ public class VolumeAttribute : UnitAttribute
141140
{
142141
public new const Unit BaseUnit = Unit.CubicMeter;
143142
public new const string XmlDocSummary = "Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces.";
144-
public VolumeAttribute(double ratio, string pluralName = null) : base(pluralName, ratio)
143+
public VolumeAttribute(double ratio, string pluralName = (string)null) : base(pluralName, ratio)
145144
{
146145
}
147146
}

0 commit comments

Comments
 (0)