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
public readonly struct RealmInteger<T> : IEquatable<T>, IComparable<RealmInteger<T>>, IComparable<T>, IConvertible, IFormattable where T : struct, IComparable<T>, IFormattable, IConvertible, IEquatable<T>
Type Parameters
Name | Description |
---|---|
T | The integer type, represented by this RealmInteger<T>. Supported types are byte, short, int, and long. |
Remarks
RealmInteger<T> is implicitly convertible to and from T/>.
Calling Increment() on a managed RealmObject/EmbeddedObject's property must be done in a write
transaction. When calling Increment() on a RealmObject/EmbeddedObject property, it will increment
the property's value in the database, so the change will be reflected the next time this property is accessed.
Methods
| Edit this page View SourceCompareTo(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 |
---|---|
int | 1 if this instance is greater than |
CompareTo(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 |
---|---|
int | 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 |
---|---|
bool | 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
| Edit this page 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
| Edit this page View Sourceoperator --(RealmInteger<T>)
Decrements the value of the integer by 1. Equivalent to calling Decrement().
Declaration
public static RealmInteger<T> operator --(RealmInteger<T> source)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | source | The RealmInteger<T> that will be decremented. |
Returns
Type | Description |
---|---|
RealmInteger<T> | The decremented value. |
operator ==(RealmInteger<T>, RealmInteger<T>)
Compares two RealmInteger<T> instances for equality.
Declaration
public static bool operator ==(RealmInteger<T> first, RealmInteger<T> second)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | first | The first RealmInteger<T>. |
RealmInteger<T> | second | The second RealmInteger<T>. |
Returns
Type | Description |
---|---|
bool |
|
operator >(RealmInteger<T>, RealmInteger<T>)
Compares two RealmInteger<T> values.
Declaration
public static bool operator >(RealmInteger<T> left, RealmInteger<T> right)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | left | The first RealmInteger<T>. |
RealmInteger<T> | right | The second RealmInteger<T>. |
Returns
Type | Description |
---|---|
bool |
|
operator >=(RealmInteger<T>, RealmInteger<T>)
Compares two RealmInteger<T> values.
Declaration
public static bool operator >=(RealmInteger<T> left, RealmInteger<T> right)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | left | The first RealmInteger<T>. |
RealmInteger<T> | right | The second RealmInteger<T>. |
Returns
Type | Description |
---|---|
bool |
|
implicit operator T(RealmInteger<T>)
Converts a RealmInteger<T> to its underlying value.
Declaration
public static implicit operator T(RealmInteger<T> i)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | i | The RealmInteger<T>. |
Returns
Type | Description |
---|---|
T |
implicit operator RealmInteger<T>(T)
Constructs a RealmInteger<T> from its underlying value.
Declaration
public static implicit operator RealmInteger<T>(T i)
Parameters
Type | Name | Description |
---|---|---|
T | i | The value. |
Returns
Type | Description |
---|---|
RealmInteger<T> |
operator ++(RealmInteger<T>)
Increments the value of the integer by 1. Equivalent to calling Increment().
Declaration
public static RealmInteger<T> operator ++(RealmInteger<T> source)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | source | The RealmInteger<T> that will be incremented. |
Returns
Type | Description |
---|---|
RealmInteger<T> | The incremented value. |
operator !=(RealmInteger<T>, RealmInteger<T>)
Compares two RealmInteger<T> instances for inequality.
Declaration
public static bool operator !=(RealmInteger<T> first, RealmInteger<T> second)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | first | The first RealmInteger<T>. |
RealmInteger<T> | second | The second RealmInteger<T>. |
Returns
Type | Description |
---|---|
bool |
|
operator <(RealmInteger<T>, RealmInteger<T>)
Compares two RealmInteger<T> values.
Declaration
public static bool operator <(RealmInteger<T> left, RealmInteger<T> right)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | left | The first RealmInteger<T>. |
RealmInteger<T> | right | The second RealmInteger<T>. |
Returns
Type | Description |
---|---|
bool |
|
operator <=(RealmInteger<T>, RealmInteger<T>)
Compares two RealmInteger<T> values.
Declaration
public static bool operator <=(RealmInteger<T> left, RealmInteger<T> right)
Parameters
Type | Name | Description |
---|---|---|
RealmInteger<T> | left | The first RealmInteger<T>. |
RealmInteger<T> | right | The second RealmInteger<T>. |
Returns
Type | Description |
---|---|
bool |
|