Skip to content

Commit

Permalink
fixes #74: add int extensions methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dgg committed Jul 3, 2024
1 parent 8f5646b commit d3d4915
Show file tree
Hide file tree
Showing 4 changed files with 296 additions and 150 deletions.
29 changes: 26 additions & 3 deletions src/NMoneys/Extensions/Money.Aliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,40 @@ public static partial class MoneyExtensions
/// </summary>
/// <param name="amount">The <see cref="Money.Amount"/> of the monetary quantity.</param>
/// <returns>A <see cref="Money"/> with the specified <paramref name="amount"/> and <see cref="Currency.Euro"/>.</returns>
public static Money Euros(this decimal amount) { return new Money(amount, Currency.Euro); }
public static Money Euros(this decimal amount) => new(amount, Currency.Euro);

/// <summary>
/// Creates an <see cref="Money"/> instance with the specified Currency.
/// </summary>
/// <param name="amount">The <see cref="Money.Amount"/> of the monetary quantity.</param>
/// <returns>A <see cref="Money"/> with the specified <paramref name="amount"/> and <see cref="Currency.Euro"/>.</returns>
public static Money Euros(this int amount) => new(amount, Currency.Euro);

/// <summary>
/// Creates an <see cref="Money"/> instance with the specified Currency.
/// </summary>
/// <param name="amount">The <see cref="Money.Amount"/> of the monetary quantity.</param>
/// <returns>A <see cref="Money"/> with the specified <paramref name="amount"/> and <see cref="Currency.Dollar"/>.</returns>
public static Money Dollars(this decimal amount) => new(amount, Currency.Dollar);

/// <summary>
/// Creates an <see cref="Money"/> instance with the specified Currency.
/// </summary>
/// <param name="amount">The <see cref="Money.Amount"/> of the monetary quantity.</param>
/// <returns>A <see cref="Money"/> with the specified <paramref name="amount"/> and <see cref="Currency.Dollar"/>.</returns>
public static Money Dollars(this decimal amount) { return new Money(amount, Currency.Dollar); }
public static Money Dollars(this int amount) => new(amount, Currency.Dollar);

/// <summary>
/// Creates an <see cref="Money"/> instance with the specified Currency.
/// </summary>
/// <param name="amount">The <see cref="Money.Amount"/> of the monetary quantity.</param>
/// <returns>A <see cref="Money"/> with the specified <paramref name="amount"/> and <see cref="Currency.Pound"/>.</returns>
public static Money Pounds(this decimal amount) => new(amount, Currency.Pound);

/// <summary>
/// Creates an <see cref="Money"/> instance with the specified Currency.
/// </summary>
/// <param name="amount">The <see cref="Money.Amount"/> of the monetary quantity.</param>
/// <returns>A <see cref="Money"/> with the specified <paramref name="amount"/> and <see cref="Currency.Pound"/>.</returns>
public static Money Pounds(this decimal amount) { return new Money(amount, Currency.Pound); }
public static Money Pounds(this int amount) => new(amount, Currency.Pound);
}
Loading

0 comments on commit d3d4915

Please sign in to comment.