Skip to content
This repository was archived by the owner on Nov 10, 2020. It is now read-only.
This repository was archived by the owner on Nov 10, 2020. It is now read-only.

Enumerations for options that are Strings #35

Description

@amhed

Instead of declaring string properties that are string constants like this:

var invoice = new Invoice
{
    Type = "ACCREC",
    Status = "DRAFT",
    Contact = contact
    ...
}

Why not something like this:

var invoice = new Invoice
{
    Type = InvoiceType.AccountsReceivable,
    Status = InvoiceStatus.Draft,
    Contact = contact
    ...
}

Implementation could be something like this:

namespace XeroApi.Model.Constants
{
        public class InvoiceType
    {
        public static string AccountsReceivable {
            get {return "ACCREC"};
        }

        public static string AccountsPayable {
            get {return "ACCPAY"};
        }
    }
}

Let me know if you guys think its a good idea and I'll submit a pull request :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions