Class Address
Address of creditor or debtor.
You can either set street, house number, postal code and town (type structured address) or address line 1 and 2 (type combined address elements). The type is automatically set once any of these fields is set. Before setting the fields, the address type is undetermined. If fields of both types are set, the address type becomes conflicting. Name and country code must always be set unless all fields are empty.
Banks will no longer accept payments using the combined address elements starting November 21, 2025. Therefore, it is recommended to use structured addresses immediately.
Inheritance
Implements
Inherited Members
Namespace: Codecrete.SwissQRBill.Generator
Assembly: Codecrete.SwissQRBill.Core.dll
Syntax
public sealed class Address : IEquatable<Address>
Properties
| Improve this Doc View SourceAddressLine1
Gets or sets the address line 1.
Address line 1 contains street name, house number or P.O. box.
Setting this field sets the address type to CombinedElements unless it's already Structured, in which case it becomes Conflicting.
This field is only used for combined address elements and is optional. Starting November 25, 2025, banks will no longer accept payments using combined address elements.
Declaration
[Obsolete("Use a structured address instead. Will be removed in version 4.")]
public string AddressLine1 { get; set; }
Property Value
Type | Description |
---|---|
System.String | The address line 1. |
AddressLine2
Gets or sets the address line 2.
Address line 2 contains postal code and town.
Setting this field sets the address type to CombinedElements unless it's already Structured, in which case it becomes Conflicting.
This field is only used for combined address elements. For this type, it is mandatory. Starting November 25, 2025, banks will no longer accept payments using combined address elements.
Declaration
[Obsolete("Use a structured address instead. Will be removed in version 4.")]
public string AddressLine2 { get; set; }
Property Value
Type | Description |
---|---|
System.String | The address line 2. |
CountryCode
Gets or sets the two-letter ISO country code.
The country code is mandatory unless the entire address contains null
or empty values.
Declaration
public string CountryCode { get; set; }
Property Value
Type | Description |
---|---|
System.String | The ISO country code. |
HouseNo
Gets or sets the house number.
Setting this field sets the address type to Structured unless it's already CombinedElements, in which case it becomes Conflicting.
This field is only used for structured addresses and is optional.
Declaration
public string HouseNo { get; set; }
Property Value
Type | Description |
---|---|
System.String | The house number. |
Name
Gets or sets the name, either the first and last name of a natural person or the company name of a legal person.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name. |
PostalCode
Gets or sets the postal code.
Setting this field sets the address type to Structured unless it's already CombinedElements, in which case it becomes Conflicting.
This field is only used for structured addresses. For this type, it's mandatory.
Declaration
public string PostalCode { get; set; }
Property Value
Type | Description |
---|---|
System.String | The postal code. |
Street
Gets or sets the street.
The street must be specified without house number.
Setting this field sets the address type to Structured unless it's already CombinedElements, in which case it becomes Conflicting.
This field is only used for structured addresses and is optional.
Declaration
public string Street { get; set; }
Property Value
Type | Description |
---|---|
System.String | The street. |
Town
Gets or sets the town or city.
Setting this field sets the address type to Structured unless it's already CombinedElements, in which case it becomes Conflicting.
This field is only used for structured addresses. For this type, it's mandatory.
Declaration
public string Town { get; set; }
Property Value
Type | Description |
---|---|
System.String | The town or city. |
Type
Gets the address type.
The address type is automatically set by either setting street / house number or address line 1 and 2. Before setting the fields, the address type is Undetermined. If fields of both types are set, the address type becomes Conflicting.
Declaration
public Address.AddressType Type { get; }
Property Value
Type | Description |
---|---|
Address.AddressType | The address type. |
Methods
| Improve this Doc View SourceClear()
Clears all fields and sets the type to Undetermined.
Declaration
public void Clear()
Equals(Address)
Determines whether the specified address is equal to the current address.
Declaration
public bool Equals(Address other)
Parameters
Type | Name | Description |
---|---|---|
Address | other | The address to compare with the current address. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Equals(Object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
GetHashCode()
Gets the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for the current object. |