# Claunia.PropertyList.NSNumber

plist-cil : Claunia.PropertyList Namespace

# NSNumber Class

A number whose value is either an integer, a real number or bool.

## Syntax

public class NSNumber : NSObject, IComparable

## Remarks

Documentation for this section has not yet been entered.

## Requirements

Namespace: Claunia.PropertyList
Assembly: plist-cil (in plist-cil.dll)
Assembly Versions: 1.13.0.0, 1.14.0.0

## Members

See Also: Inherited members from NSObject.

## Public Constructors

| NSNumber (bool) | Creates a bool number.
| NSNumber (double) | Creates a real number.
| NSNumber (int) | Creates an integer number.
| NSNumber (long) | Creates an integer number.
| NSNumber (string) | Creates a number from its textual representation.
| NSNumber (byte[], int) | Parses integers and real numbers from their binary representation. Note: real numbers are not yet supported.

## Public Fields

const | BOOLEAN | int (2). Indicates that the number's value is bool.
const | INTEGER | int (0). Indicates that the number's value is an integer. The number is stored as a .NET long. Its original value could have been char, short, int, long or even long long.
const | REAL | int (1). Indicates that the number's value is a real number. The number is stored as a .NET double. Its original value could have been float or double.

## Public Methods

CompareTo (object) : int

> Compares the current Claunia.PropertyList.NSNumber to the specified object.

override

Equals (NSObject) : bool

> Determines whether the specified Claunia.PropertyList.NSObject is equal to the current Claunia.PropertyList.NSNumber.

abstract

Equals (NSObject) : bool

> Determines if the specific NSObject is the same as the NSObject overriding this method. (Inherited from NSObject.)

override

Equals (object) : bool

> Checks whether the other object is a NSNumber of the same value.

floatValue () : float

> The number's float value. WARNING: Possible loss of precision if the value is outside the float range.

override

GetHashCode () : int

> Serves as a hash function for a Claunia.PropertyList.NSNumber object.

GetNSNumberType () : int

> Gets the type of this number's value.

isBoolean () : bool

> Checks whether the value of this NSNumber is a bool.

isInteger () : bool

> Checks whether the value of this NSNumber is an integer.

isReal () : bool

> Checks whether the value of this NSNumber is a real number.

ToBool () : bool

> The number's bool value.

ToDouble () : double

> The number's double value.

ToInt () : int

> The number's int value. Note: Even though the number's type might be INTEGER it can be larger than a Java int. Use intValue() only if you are certain that it contains a number from the int range. Otherwise the value might be innaccurate.

ToLong () : long

> The number's long value.

ToObject () : object

> Converts this NSObject into an equivalent object of the .NET Runtime Environment.

> Claunia.PropertyList.NSArray objects are converted to arrays.

> Claunia.PropertyList.NSDictionary objects are converted to objects extending the Dictionary`2 class.

> Claunia.PropertyList.NSSet objects are converted to objects extending the List`1 class.

> Claunia.PropertyList.NSNumber objects are converted to primitive number values (int, long, double or bool).

> Claunia.PropertyList.NSString objects are converted to string objects.

> Claunia.PropertyList.NSData objects are converted to byte arrays.

> Claunia.PropertyList.NSDate objects are converted to DateTime objects.

> Claunia.PropertyList.UID objects are converted to byte arrays.

> (Inherited from NSObject.)

override

ToString () : string

> Returns a string that represents the current Claunia.PropertyList.NSNumber.

ToXmlPropertyList () : string

> Generates a valid XML property list including headers using this object as root. (Inherited from NSObject.)

## Member Details

### NSNumber Constructor

> Creates a bool number.

> ## Syntax

> public NSNumber (bool b)

> #### Parameters

> > b
> >   The bool value.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### NSNumber Constructor

> Creates a real number.

> ## Syntax

> public NSNumber (double d)

> #### Parameters

> > d
> >   The real value.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### NSNumber Constructor

> Creates an integer number.

> ## Syntax

> public NSNumber (int i)

> #### Parameters

> > i
> >   The integer value.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### NSNumber Constructor

> Creates an integer number.

> ## Syntax

> public NSNumber (long l)

> #### Parameters

> > l
> >   The long integer value.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### NSNumber Constructor

> Creates a number from its textual representation.

> ## Syntax

> public NSNumber (string text)

> #### See Also

> > bool.Parse(string)
> > long.Parse(string)
> > double.Parse(string, IFormatProvider)

> #### Parameters

> > text
> >   The textual representation of the number.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### NSNumber Constructor

> Parses integers and real numbers from their binary representation. Note: real numbers are not yet supported.

> ## Syntax

> public NSNumber (byte[] bytes, int type)

> #### See Also

> > NSNumber.INTEGER
> > NSNumber.REAL

> #### Parameters

> > bytes
> >   The binary representation
> > type
> >   The type of number

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### BOOLEAN Field

> Indicates that the number's value is bool.

> Value: 2

> ## Syntax

> public const int BOOLEAN

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### CompareTo Method

> Compares the current Claunia.PropertyList.NSNumber to the specified object.

> ## Syntax

> public int CompareTo (object o)

> #### Parameters

> > o
> >   Object to compare to the current Claunia.PropertyList.NSNumber.

> #### Returns

> > 0 if the numbers are equal, 1 if the current Claunia.PropertyList.NSNumber is greater than the argument and -1 if it is less, or the argument is not a number.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### Equals Method

> Determines whether the specified Claunia.PropertyList.NSObject is equal to the current Claunia.PropertyList.NSNumber.

> ## Syntax

> public override bool Equals (NSObject obj)

> #### Parameters

> > obj
> >   The Claunia.PropertyList.NSObject to compare with the current Claunia.PropertyList.NSNumber.

> #### Returns

> > `true` if the specified Claunia.PropertyList.NSObject is equal to the current Claunia.PropertyList.NSNumber; otherwise, `false`.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### Equals Method

> Checks whether the other object is a NSNumber of the same value.

> ## Syntax

> public override bool Equals (object obj)

> #### Parameters

> > obj
> >   The object to compare to.

> #### Returns

> > Whether the objects are equal in terms of numeric value and type.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### floatValue Method

> The number's float value. WARNING: Possible loss of precision if the value is outside the float range.

> ## Syntax

> public float floatValue ()

> #### Returns

> > The value of the number as float.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### GetHashCode Method

> Serves as a hash function for a Claunia.PropertyList.NSNumber object.

> ## Syntax

> public override int GetHashCode ()

> #### Returns

> > A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a hash table.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### GetNSNumberType Method

> Gets the type of this number's value.

> ## Syntax

> public int GetNSNumberType ()

> #### See Also

> > NSNumber.BOOLEAN
> > NSNumber.INTEGER
> > NSNumber.REAL

> #### Returns

> > The type flag.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### INTEGER Field

> Indicates that the number's value is an integer. The number is stored as a .NET long. Its original value could have been char, short, int, long or even long long.

> Value: 0

> ## Syntax

> public const int INTEGER

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### isBoolean Method

> Checks whether the value of this NSNumber is a bool.

> ## Syntax

> public bool isBoolean ()

> #### Returns

> > Whether the number's value is a bool.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### isInteger Method

> Checks whether the value of this NSNumber is an integer.

> ## Syntax

> public bool isInteger ()

> #### Returns

> > Whether the number's value is an integer.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### isReal Method

> Checks whether the value of this NSNumber is a real number.

> ## Syntax

> public bool isReal ()

> #### Returns

> > Whether the number's value is a real number.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### REAL Field

> Indicates that the number's value is a real number. The number is stored as a .NET double. Its original value could have been float or double.

> Value: 1

> ## Syntax

> public const int REAL

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### ToBool Method

> The number's bool value.

> ## Syntax

> public bool ToBool ()

> #### Returns

> > `true` if the value is true or non-zero, `false` otherwise.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### ToDouble Method

> The number's double value.

> ## Syntax

> public double ToDouble ()

> #### Returns

> > The value of the number as double.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### ToInt Method

> The number's int value. Note: Even though the number's type might be INTEGER it can be larger than a Java int. Use intValue() only if you are certain that it contains a number from the int range. Otherwise the value might be innaccurate.

> ## Syntax

> public int ToInt ()

> #### Returns

> > The value of the number as int.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### ToLong Method

> The number's long value.

> ## Syntax

> public long ToLong ()

> #### Returns

> > The value of the number as long

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0

### ToString Method

> Returns a string that represents the current Claunia.PropertyList.NSNumber.

> ## Syntax

> public override string ToString ()

> #### Returns

> > A string that represents the current Claunia.PropertyList.NSNumber.

> ## Remarks

> Documentation for this section has not yet been entered.

> ## Requirements

> Namespace: Claunia.PropertyList
> Assembly: plist-cil (in plist-cil.dll)
> Assembly Versions: 1.13.0.0, 1.14.0.0