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, Int16, Int32, and Int64. |
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
| 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 |
---|---|
int | 1 if this instance is greater than |
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.
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 |
---|---|
int | 1 if this instance is greater than |
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.
Decrement()
Decrements the integer value by 1. Inverse of Increment().
Declaration
public RealmInteger<T> Decrement()
Returns
Type | Description |
---|---|
RealmInteger<T> | The decremented value. |
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.
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. |
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.
Increment()
Increments the integer value by 1. Inverse of Decrement().
Declaration
public RealmInteger<T> Increment()
Returns
Type | Description |
---|---|
RealmInteger<T> | The incremented value. |
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.
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. |
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.
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
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.
ToString(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. |
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.
Operators
| Improve this Doc 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. |
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.
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 |
|
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.
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 |
|
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.
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 |
|
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.
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> |
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.
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 |
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.
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. |
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.
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 |
|
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.
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 |
|
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.
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 |
|
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.