Class Money
Represents an amount of money with its currency type.
Inheritance
System.Object
Money
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: Google.Api.CommonProtos.dll
Syntax
public sealed class Money : IMessage<Money>, IMessage, IEquatable<Money>, IDeepCloneable<Money>
Constructors
Money()
Declaration
Money(Money)
Declaration
public Money(Money other)
Parameters
| Type |
Name |
Description |
| Money |
other |
|
Fields
CurrencyCodeFieldNumber
Field number for the "currency_code" field.
Declaration
public const int CurrencyCodeFieldNumber = 1
Field Value
| Type |
Description |
| System.Int32 |
|
NanosFieldNumber
Field number for the "nanos" field.
Declaration
public const int NanosFieldNumber = 3
Field Value
| Type |
Description |
| System.Int32 |
|
UnitsFieldNumber
Field number for the "units" field.
Declaration
public const int UnitsFieldNumber = 2
Field Value
| Type |
Description |
| System.Int32 |
|
Properties
CurrencyCode
The 3-letter currency code defined in ISO 4217.
Declaration
public string CurrencyCode { get; set; }
Property Value
| Type |
Description |
| System.String |
|
DecimalValue
The amount of money in System.Decimal format. This is an abstraction of the Units and Nanos properties.
Getting this property combines those property values, and setting this property will set both of those properties.
Declaration
public decimal DecimalValue { get; set; }
Property Value
| Type |
Description |
| System.Decimal |
|
Exceptions
| Type |
Condition |
| System.ArgumentOutOfRangeException |
The integral part of the decimal must be a valid System.Int64, and the fractional part must have a maximum of 9 digits of precision.
|
Descriptor
Declaration
public static MessageDescriptor Descriptor { get; }
Property Value
Nanos
Number of nano (10^-9) units of the amount.
The value must be between -999,999,999 and +999,999,999 inclusive.
If units is positive, nanos must be positive or zero.
If units is zero, nanos can be positive, zero, or negative.
If units is negative, nanos must be negative or zero.
For example $-1.75 is represented as units=-1 and nanos=-750,000,000.
Declaration
public int Nanos { get; set; }
Property Value
| Type |
Description |
| System.Int32 |
|
Parser
Declaration
public static MessageParser<Money> Parser { get; }
Property Value
Units
The whole units of the amount.
For example if currencyCode is "USD", then 1 unit is one US dollar.
Declaration
public long Units { get; set; }
Property Value
| Type |
Description |
| System.Int64 |
|
Methods
CalculateSize()
Declaration
public int CalculateSize()
Returns
| Type |
Description |
| System.Int32 |
|
Implements
Clone()
Declaration
Returns
Implements
Equals(Money)
Declaration
public bool Equals(Money other)
Parameters
| Type |
Name |
Description |
| Money |
other |
|
Returns
| Type |
Description |
| System.Boolean |
|
Implements
System.IEquatable<T>.Equals(T)
Equals(Object)
Declaration
public override bool Equals(object other)
Parameters
| Type |
Name |
Description |
| System.Object |
other |
|
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
System.Object.Equals(System.Object)
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type |
Description |
| System.Int32 |
|
Overrides
System.Object.GetHashCode()
Declaration
public void MergeFrom(CodedInputStream input)
Parameters
Implements
MergeFrom(Money)
Declaration
public void MergeFrom(Money other)
Parameters
| Type |
Name |
Description |
| Money |
other |
|
Implements
ToString()
Declaration
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides
System.Object.ToString()
WriteTo(CodedOutputStream)
Declaration
public void WriteTo(CodedOutputStream output)
Parameters
Implements
Explicit Interface Implementations
IMessage.Descriptor
Declaration
MessageDescriptor IMessage.Descriptor { get; }
Returns
Implements