50 lines
971 B
C#
50 lines
971 B
C#
namespace AssetManager.Models;
|
|
|
|
/// <summary>
|
|
/// 支持的币种枚举
|
|
/// </summary>
|
|
public enum Currency
|
|
{
|
|
/// <summary>
|
|
/// 人民币
|
|
/// </summary>
|
|
CNY = 0,
|
|
|
|
/// <summary>
|
|
/// 美元
|
|
/// </summary>
|
|
USD = 1,
|
|
|
|
/// <summary>
|
|
/// 港币
|
|
/// </summary>
|
|
HKD = 2
|
|
}
|
|
|
|
/// <summary>
|
|
/// 币种辅助类
|
|
/// </summary>
|
|
public static class CurrencyHelper
|
|
{
|
|
private static readonly HashSet<string> _supportedCurrencies = new(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
"CNY", "USD", "HKD"
|
|
};
|
|
|
|
/// <summary>
|
|
/// 检查币种是否支持
|
|
/// </summary>
|
|
public static bool IsSupported(string currency)
|
|
{
|
|
return !string.IsNullOrEmpty(currency) && _supportedCurrencies.Contains(currency);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取支持的币种列表
|
|
/// </summary>
|
|
public static List<string> GetSupportedCurrencies()
|
|
{
|
|
return new List<string> { "CNY", "USD", "HKD" };
|
|
}
|
|
}
|