RomanFigure

Represents a single roman figure: I, V, L,...

Getting Instances

  RomanFigure m = RomanFigure.M;

  RomanFigure x = RomanFigure.Parse(10);
  RomanFigure d = RomanFigure.Parse('D');
  RomanFigure i = RomanFigure.Parse("I");

  RomanFigure l = (RomanFigure) 'L';
  RomanFigure v = (RomanFigure) 5;

Specification

Properties

RomanFigures have names and values:

  string nulla = RomanFigure.N.Name;
  string L = RomanFigure.L.ToString();
  short oneThousand = RomanFigure.M.Value;

Specification

Conversion

RomanFigure instances can be converted to and from CLR types.
Convert.ToBoolean(RomanFigure.X);
Convert.ToChar(RomanFigure.X);
Convert.ToSByte(RomanFigure.X);
Convert.ToByte(RomanFigure.X);
Convert.ToInt16(RomanFigure.X);
Convert.ToUInt16(RomanFigure.X);
Convert.ToInt32(RomanFigure.X);
Convert.ToUInt32(RomanFigure.X);
Convert.ToInt64(RomanFigure.X);
Convert.ToUInt64(RomanFigure.X);
Convert.ToSingle(RomanFigure.X);
Convert.ToDouble(RomanFigure.X);
Convert.ToDecimal(RomanFigure.X);
Convert.ToDateTime(RomanFigure.X);

Convert.ChangeType(RomanFigure.X, typeof(short));

Specification

Equality

RomanFigure implements IEquatable<RomanFigure>, IEquatable<short> and IEquatable<char>.
  RomanFigure.M.Equals(RomanFigure.Parse(1000));
  RomanFigure.D.Equals(50);
  RomanFigure.I.Equals('I');
  object o = 100;
  RomanFigure.I.Equals(o);

Specification

It also overrides equality operators, providing value equality:
  RomanFigure.I == RomanFigure.I;
  RomanFigure.I != RomanFigure.L;
  RomanFigure.I == 'I';
  RomanFigure.I != 15;

Specification

Comparisons

RomanFigure implements IComparable<RomanFigure> and IComparable<short>.

  RomanFigure.I.CompareTo(RomanFigure.I);
  RomanFigure.I.CompareTo(15);

Specification

Besides, comparison operators have been overriden against the same types:
  RomanFigure.I > RomanFigure.I;
  RomanFigure.I >=15;

Specification

Last edited Jan 4, 2012 at 3:45 PM by dgon, version 12

Comments

No comments yet.