Struct RealmInteger<T>
A structure representing an integer value in the database. It offers API to increment the value, which produces correct merges during conflicts.
Namespace: Realms
Assembly: Realm.dll
Syntax
[Preserve(AllMembers = true, Conditional = false)]
public struct RealmInteger<T> : IEquatable<T>, IComparable<RealmInteger<T>>, IComparable<T>, IConvertible, IFormattable where T : struct, IComparable<T>, IFormattable
Type Parameters
Name | Description |
---|---|
T | The integer type, represented by this RealmInteger<T>. Supported types are Byte, Int16, Int32, and Int64. |
Remarks
RealmInteger<T> is implicitly convertible to and from T/>.
Calling Increment() on a managed RealmObject's property must be done in a write
transaction. When calling Increment() on a RealmObject property, it will increment
the property's value in the database, so the change will be reflected the next time this property is accessed.
If the object is unmanaged, its property value will not be affected.
Methods
| Improve this Doc View SourceCompareTo(T)
Compares this instance to another numeric value.
Declaration
public int CompareTo(T other)
Parameters
Type | Name | Description |
---|---|---|
T | other | The value to compare to. |
Returns
Type | Description |
---|---|
Int32 | 1 if this instance is greater than |
CompareTo(RealmInteger<T>)
Compares this instance to another RealmInteger<T> value.
Declaration
public int CompareTo(RealmInteger<T> other)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | other | The value to compare to. |
Returns
Type | Description |
---|---|
Int32 | 1 if this instance is greater than |
Decrement()
Decrements the integer value by 1. Inverse of Increment().
Declaration
public RealmInteger<T> Decrement()
Returns
Type | Description |
---|---|
RealmInteger<T> | The decremented value. |
Equals(T)
Indicates whether this instance represents the same numeric value as the provided object.
Declaration
public bool Equals(T other)
Parameters
Type | Name | Description |
---|---|---|
T | other | The object to compare with the current instance. |
Returns
Type | Description |
---|---|
Boolean | true if obj and this instance represent the same numeric value; otherwise, false. |
Increment()
Increments the integer value by 1. Inverse of Decrement().
Declaration
public RealmInteger<T> Increment()
Returns
Type | Description |
---|---|
RealmInteger<T> | The incremented value. |
Increment(T)
Increment the integer value by a specified amount.
Declaration
public RealmInteger<T> Increment(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | Value by which to increment. |
Returns
Type | Description |
---|---|
RealmInteger<T> | The incremented value. |
ToString()
Returns the string representation of the underlying numeric value.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | The string representation of the numeric value. |
Overrides
| Improve this Doc View SourceToString(String, IFormatProvider)
Formats the value of the current instance using the specified format.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
String | format | The format to use. -or- A null reference to use the default format defined for the type of the IFormattable implementation. |
IFormatProvider | formatProvider | The provider to use to format the value. -or- A null reference to obtain the numeric format information from the current locale setting of the operating system |
Returns
Type | Description |
---|---|
String | The value of the current instance in the specified format. |
Operators
| Improve this Doc View SourceDecrement(RealmInteger<T>)
Declaration
public static RealmInteger<T> operator --(RealmInteger<T> source)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | source |
Returns
Type | Description |
---|---|
RealmInteger<T> |
Equality(RealmInteger<T>, RealmInteger<T>)
Declaration
public static bool operator ==(RealmInteger<T> first, RealmInteger<T> second)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | first | |
RealmInteger<T> | second |
Returns
Type | Description |
---|---|
Boolean |
GreaterThan(RealmInteger<T>, RealmInteger<T>)
Declaration
public static bool operator>(RealmInteger<T> left, RealmInteger<T> right)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | left | |
RealmInteger<T> | right |
Returns
Type | Description |
---|---|
Boolean |
GreaterThanOrEqual(RealmInteger<T>, RealmInteger<T>)
Declaration
public static bool operator >=(RealmInteger<T> left, RealmInteger<T> right)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | left | |
RealmInteger<T> | right |
Returns
Type | Description |
---|---|
Boolean |
Implicit(T to RealmInteger<T>)
Declaration
public static implicit operator RealmInteger<T>(T i)
Parameters
Type | Name | Description |
---|---|---|
T | i |
Returns
Type | Description |
---|---|
RealmInteger<T> |
Implicit(RealmInteger<T> to T)
Declaration
public static implicit operator T(RealmInteger<T> i)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | i |
Returns
Type | Description |
---|---|
T |
Increment(RealmInteger<T>)
Declaration
public static RealmInteger<T> operator ++(RealmInteger<T> source)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | source |
Returns
Type | Description |
---|---|
RealmInteger<T> |
Inequality(RealmInteger<T>, RealmInteger<T>)
Declaration
public static bool operator !=(RealmInteger<T> first, RealmInteger<T> second)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | first | |
RealmInteger<T> | second |
Returns
Type | Description |
---|---|
Boolean |
LessThan(RealmInteger<T>, RealmInteger<T>)
Declaration
public static bool operator <(RealmInteger<T> left, RealmInteger<T> right)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | left | |
RealmInteger<T> | right |
Returns
Type | Description |
---|---|
Boolean |
LessThanOrEqual(RealmInteger<T>, RealmInteger<T>)
Declaration
public static bool operator <=(RealmInteger<T> left, RealmInteger<T> right)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | left | |
RealmInteger<T> | right |
Returns
Type | Description |
---|---|
Boolean |
Explicit Interface Implementations
| Improve this Doc View SourceIConvertible.GetTypeCode()
Returns the TypeCode of the value represented by this RealmInteger<T>.
Declaration
TypeCode IConvertible.GetTypeCode()
Returns
Type | Description |
---|---|
TypeCode | The enumerated constant that is the System.TypeCode of the class or value type that implements this interface. |
IConvertible.ToBoolean(IFormatProvider)
Converts the value of this instance to an equivalent Boolean value using the specified culture-specific formatting information.
Declaration
bool IConvertible.ToBoolean(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
Boolean | A Boolean value equivalent to the value of this instance. |
IConvertible.ToByte(IFormatProvider)
Converts the value of this instance to an equivalent 8-bit unsigned integer using the specified culture-specific formatting information.
Declaration
byte IConvertible.ToByte(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
Byte | An 8-bit unsigned integer value equivalent to the value of this instance. |
IConvertible.ToChar(IFormatProvider)
Converts the value of this instance to an equivalent Unicode character using the specified culture-specific formatting information.
Declaration
char IConvertible.ToChar(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
Char | A Unicode character value equivalent to the value of this instance. |
IConvertible.ToDateTime(IFormatProvider)
Converts the value of this instance to an equivalent DateTime value using the specified culture-specific formatting information.
Declaration
DateTime IConvertible.ToDateTime(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
DateTime | A DateTime value equivalent to the value of this instance. |
IConvertible.ToDecimal(IFormatProvider)
Converts the value of this instance to an equivalent Decimal value using the specified culture-specific formatting information.
Declaration
decimal IConvertible.ToDecimal(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
Decimal | A Decimal value equivalent to the value of this instance. |
IConvertible.ToDouble(IFormatProvider)
Converts the value of this instance to an equivalent double-precision floating-point number using the specified culture-specific formatting information.
Declaration
double IConvertible.ToDouble(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
Double | A double-precision floating-point number equivalent to the value of this instance. |
IConvertible.ToInt16(IFormatProvider)
Converts the value of this instance to an equivalent 16-bit signed integer using the specified culture-specific formatting information.
Declaration
short IConvertible.ToInt16(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
Int16 | A 16-bit signed integer equivalent to the value of this instance. |
IConvertible.ToInt32(IFormatProvider)
Converts the value of this instance to an equivalent 32-bit signed integer using the specified culture-specific formatting information.
Declaration
int IConvertible.ToInt32(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
Int32 | A 32-bit signed integer equivalent to the value of this instance. |
IConvertible.ToInt64(IFormatProvider)
Converts the value of this instance to an equivalent 64-bit signed integer using the specified culture-specific formatting information.
Declaration
long IConvertible.ToInt64(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
Int64 | A 64-bit signed integer equivalent to the value of this instance. |
IConvertible.ToSByte(IFormatProvider)
Converts the value of this instance to an equivalent 8-bit signed integer using the specified culture-specific formatting information.
Declaration
sbyte IConvertible.ToSByte(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
SByte | An 8-bit signed integer equivalent to the value of this instance. |
IConvertible.ToSingle(IFormatProvider)
Converts the value of this instance to an equivalent single-precision floating-point number using the specified culture-specific formatting information.
Declaration
float IConvertible.ToSingle(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
Single | A single-precision floating-point number equivalent to the value of this instance. |
IConvertible.ToString(IFormatProvider)
Converts the value of this instance to an equivalent String value using the specified culture-specific formatting information.
Declaration
string IConvertible.ToString(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
String | A String value equivalent to the value of this instance. |
IConvertible.ToType(Type, IFormatProvider)
Converts the value of this instance to an Object of the specified Type that has an equivalent value, using the specified culture-specific formatting information.
Declaration
object IConvertible.ToType(Type conversionType, IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
Type | conversionType | The Type to which the value of this instance is converted. |
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
Object | An Object instance of type |
IConvertible.ToUInt16(IFormatProvider)
Converts the value of this instance to an equivalent 16-bit unsigned integer using the specified culture-specific formatting information.
Declaration
ushort IConvertible.ToUInt16(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
UInt16 | A 16-bit unsigned integer equivalent to the value of this instance. |
IConvertible.ToUInt32(IFormatProvider)
Converts the value of this instance to an equivalent 32-bit unsigned integer using the specified culture-specific formatting information.
Declaration
uint IConvertible.ToUInt32(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
UInt32 | A 32-bit unsigned integer equivalent to the value of this instance. |
IConvertible.ToUInt64(IFormatProvider)
Converts the value of this instance to an equivalent 64-bit unsigned integer using the specified culture-specific formatting information.
Declaration
ulong IConvertible.ToUInt64(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | An IFormatProviderinterface implementation that supplies culture-specific formatting information. |
Returns
Type | Description |
---|---|
UInt64 | A 64-bit unsigned integer equivalent to the value of this instance. |