- code.zip
- ConsoleApplicationUnitsOfMeasureDemo
- HDUnitsOfMeasure.sln
- HDUnitsOfMeasure.sln.docstates.suo
- HDUnitsOfMeasure.suo
- HDUnitsOfMeasure
- bin.zip
- HDUnitsOfMeasure.dll
- HDUnitsOfMeasure.XML
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HDLibrary.UnitsOfMeasure
{
/// <summary>
/// Defines a new unit
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = true)]
public sealed class UnitDefinitionAttribute : Attribute
{
/// <summary>
/// Defines a new base unit
/// </summary>
/// <param name="unitAbbr">The abbreviation of the unit, e.g. "m"</param>
/// <param name="unitName">The name of the unit, e.g. "Meter"</param>
public UnitDefinitionAttribute(string unitAbbr, string unitName)
{
UnitAbbr = unitAbbr;
UnitName = unitName;
Definition = null;
}
/// <summary>
/// Defines a new scaled, shifted or derived unit
/// </summary>
/// <param name="unitAbbr">The abbreviation of the unit, e.g. "m"</param>
/// <param name="unitName">The name of the unit, e.g. "Meter"</param>
/// <param name="definition">The definition, e.g. "1000 m" or "m / s"</param>
public UnitDefinitionAttribute(string unitAbbr, string unitName, string definition)
{
UnitAbbr = unitAbbr;
UnitName = unitName;
Definition = definition;
}
public string UnitAbbr { get; private set; }
public string UnitName { get; private set; }
public string Definition { get; private set; }
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Presently I am a student of computer science at the Karlsruhe Institute of Technology in Germany.